badri@ur-valhalla.UUCP (Badri Lokanathan) (10/02/88)
Posting-number: Volume 4, Issue 111 Submitted-by: "Badri Lokanathan" <badri@ur-valhalla.UUCP> Archive-name: spell_check.sh I needed a general purpose spelling checker: spell is inconvenient in the sense that it only prints words that are wrong. So if you pipe your text (say within vi) through spell, guess what - you are left with just the mispelt words. So I came up with the following shell script, based on spell, that works nicely. NOTE: In case the sed script gets mauled on the way, the [] brackets enclose a space and a tab. ----Cut here ---------%< SH SCRIPT FOLLOWS ------------------------------- #!/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 # # # # The wrongly spelt words will be surrounded by ###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 spell < $doc | sed -e 's/^/s;\\([ ][ ]*\\)\\(/ s/$/\\)\\([ ][ ]*\\);\\1###\\2###\\3;g/' > $scr sed -f $scr $doc rm -f $doc $scr -- "We will fight for the right to be free {) badri@valhalla.ee.rochester.edu We will build our own society //\\ {ames,cmcl2,columbia,cornell, And we will sing, we will sing ///\\\ garp,harvard,ll-xn,rutgers}! We will sing our own song." -UB40 _||_ rochester!ur-valhalla!badri