v04i111: A short spelling check script
Badri Lokanathan
badri at ur-valhalla.UUCP
Sun Oct 2 07:28:21 AEST 1988
Posting-number: Volume 4, Issue 111
Submitted-by: "Badri Lokanathan" <badri at 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 at 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
More information about the Comp.sources.misc
mailing list