Path: utzoo!utgpu!water!watmath!clyde!bellcore!rutgers!tut.cis.ohio-state.edu!cwjcc!hal!ncoast!allbery From: badri@ur-valhalla.UUCP (Badri Lokanathan) Newsgroups: comp.sources.misc Subject: v04i111: A short spelling check script Keywords: Spelling check in vi Message-ID: <1505@valhalla.ee.rochester.edu> Date: 1 Oct 88 21:28:21 GMT Sender: allbery@ncoast.UUCP Reply-To: badri@ur-valhalla.UUCP (Badri Lokanathan) Organization: UR Dept. of Electrical Engg, Rochester NY 14627 Lines: 41 Approved: allbery@ncoast.UUCP Posting-number: Volume 4, Issue 111 Submitted-by: "Badri Lokanathan" 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