v04i112: SUPERSEDES v04i111: A convenient spelling filter based on 'spell' (revised)
Badri Lokanathan
badri at ur-valhalla.UUCP
Tue Oct 4 11:13:07 AEST 1988
Posting-number: Volume 4, Issue 112
Submitted-by: "Badri Lokanathan" <badri at 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 at 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
More information about the Comp.sources.misc
mailing list