home *** CD-ROM | disk | FTP | other *** search
- From decwrl!purdue!mailrus!ukma!cwjcc!hal!ncoast!allbery Tue Oct 4 07:33:22 PDT 1988
- Article 654 of comp.sources.misc:
- Path: granite!decwrl!purdue!mailrus!ukma!cwjcc!hal!ncoast!allbery
- From: badri@ur-valhalla.UUCP (Badri Lokanathan)
- Newsgroups: comp.sources.misc
- Subject: v04i112: SUPERSEDES v04i111: A convenient spelling filter based on 'spell' (revised)
- Keywords: spell,vi
- Message-ID: <1509@valhalla.ee.rochester.edu>
- Date: 4 Oct 88 01:13:07 GMT
- Sender: allbery@ncoast.UUCP
- Reply-To: badri@ur-valhalla.UUCP (Badri Lokanathan)
- Organization: UR Dept. of Electrical Engg, Rochester NY 14627
- Lines: 59
- Approved: allbery@ncoast.UUCP
- Supersedes: <1505@valhalla.ee.rochester.edu>
-
- Posting-number: Volume 4, Issue 112
- Submitted-by: "Badri Lokanathan" <badri@ur-valhalla.UUCP>
- Archive-name: spell_check.sh
-
- (To the moderator: I posted an earlier version which was incomplete and
- buggy; I am not even sure if it reached you. Please cancel it.)
- [Superseded; let's see if this works as claimed. ++bsa]
-
- The following shell script, based on spell, is convenient for highlighting
- spelling errors, either in a vi session or stand alone. I wrote it so
- that I could pipe text from within a vi session through it.
- (Note that you cannot just say
- !}spell
- in vi since it would destroy your text!)
- [It may anyway. Many "vi"'s have a bug when large amounts of text are piped
- to/from a command. You have been warned! ++bsa]
-
- ------------%< cut here and save in spell_check ----------------------------
- #!/bin/sh
- ############################################################################
- # A sh script to allow spelling checks either in vi or stand alone #
- # Usage: spell_check < file or within vi, #
- # !}spell_check or #
- # :(addressed lines)!spell_check #
- # #
- # Wrongly spelled words will be surrounded as ###bad-word### #
- # WARNING: Do not try and sell this tiny shell script to some #
- # poor sucker! #
- # Badri Lokanathan, 30 September 1988 #
- ############################################################################
- doc=/tmp/splchk.$$
- scr=/tmp/sedscr.$$
-
- trap 'rm -f $doc $scr; exit 1' 1 2 15
- cat > $doc
-
- cat > $scr <<HEAD
- s/^/ /
- s/\$/ /
- HEAD
-
- spell < $doc |
- sed -e 's/^/s;\\([ ][^a-zA-Z0-9]*\\)\\(/
- s/$/\\)\\([^a-zA-Z0-9]*[ ]\\);\\1###\\2###\\3;g/
- s/ $//' >> $scr
-
- cat >> $scr <<TAIL
- s/^ //
- s/ \$//
- TAIL
-
- sed -f $scr $doc
- rm -f $doc $scr
-
- --
- "I care about my fellow man {) badri@valhalla.ee.rochester.edu
- Being taken for a ride, //\\ {ames,cmcl2,columbia,cornell,
- I care that things start changing ///\\\ garp,harvard,ll-xn,rutgers}!
- But there's no one on my side."-UB40 _||_ rochester!ur-valhalla!badri
-
-
-