Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!brl-tgr!tgr!RSanders@DENVER.ARPA From: RSanders@DENVER.ARPA Newsgroups: net.sources Subject: spellfix - interactive spelling checker and fixer Message-ID: <10091@brl-tgr.ARPA> Date: Sun, 21-Apr-85 02:18:26 EST Article-I.D.: brl-tgr.10091 Posted: Sun Apr 21 02:18:26 1985 Date-Received: Tue, 23-Apr-85 00:47:23 EST Sender: news@brl-tgr.ARPA Lines: 146 Tired of scribbling lists of misspelled words on random scraps of paper after using spell? (If you never use spell, skip this message). Spellfix is a reasonably convenient hack. Be sure to check out the BUGS section of the man page - someday, I'll work out a sed/awk syntax for troff requests that will fix that bug. Cut at the dotted lines. This works for us on VAX/4.2 BSD (ran under 4.1 also). -- Rex ......................................................................... .TH SPELLFIX 1 LOCAL "USGS Pacific Marine Geology" .SH NAME spellfix - interactively fix spelling errors .SH SYNOPSIS .B spellfix file .SH DESCRIPTION .PP .I spellfix is an interactive spelling checker and fixer. Using .I spellfix is a 4 step process: .TP 1. Type: .sp .B spellfix .I file .sp where .I file is the name of your manuscript. .TP 2. Edit the misspelled words to leave only the words you want flagged in your manuscript. .TP 3. Edit the temporary copy of your original file. The words you left in step 2 will be flagged with lines like: .br .sp .ec + .\" ### spell: foobar %%% .ec .br .sp where .I foobar is a misspelled word. You should correct the misspellings on the text lines that follow. The flag lines will be removed automatically before the next step. .TP 4. Answer .IR spellfix 's question: .sp overwrite .I file ? .sp with .B yes or .BR no . If your answer is yes, .I spellfix will replace your original file with the file you created in step 3. .SH NOTES In step 3, the search string for .IR vi (1) is set to "###"; you can conveniently search for the next spelling error with the "n" request. .PP .I spellfix was inspired by .IR error (1). .PP The peculiar look of the flag lines is an attempt to make them .IR troff (1) comments. .SH SEE ALSO spell(1), vi(1), troff(1), error(1), myspell(1), myspellfix(1). .SH BUGS .PP .I spellfix can insert more error lines than needed. For example, if .I spell rejects 'teache', lines with 'teacher' will be marked as erroneous. .SH AUTHOR Rex Sanders, U.S. Geological Survey, Pacific Marine Geology .............................................................................. #! /bin/sh # spellfix - interactive spelling checker and fixer # Rex Sanders, USGS Pacific Marine Geology t1=/tmp/$$.1 t2=/tmp/$$.2 t3=/tmp/$$.3 if [ $# -ne 1 ] then echo "Usage: spellfix filename" >&2 exit 1 fi trap 'rm -f $t1 $t2 $t3; exit 2' 1 2 15 echo "Checking spelling errors in $1 ..." spell $1 > $t1 if [ ! -s $t1 ] then rm -f $t1 exit 0 fi echo "Editing `wc -l <$t1` misspelled words - leave only truly misspelled words. " sleep 3 vi $t1 echo "Editing a temporary copy of $1 - fix spelling errors " cat $t1 | while read word do echo "/${word}/i\ .\\\" ### spell: ${word} %%%" >> $t3 done if (sed -f $t3 < $1 > $t2 2> /dev/null) then sleep 3 vi +/###/ $t2 sed -e '/^\.\" ### spell: .* %%%$/d' $t2 > $t3 cp -i $t3 $1 else echo "spellfix: error processing misspelled words - file $1 not affected." >&2 rm -f $t1 $t2 $t3 exit 1 fi rm -f $t1 $t2 $t3