/usr/dict/words

Brian Fennell fenn at wpi.WPI.EDU
Thu Jan 10 15:47:48 AEST 1991


In article <quan.663477169 at sol> quan at sol.surv.utas.oz (Stephen Quan) writes:
>/usr/dict/words contains words from (I presume) the Oxford English Dictionary.
>Is there any spell checking utilities that make use of this?  So far, the only
>utility I know of is the 'look' command.
>
>Steve Quan,
>Uni. of Tas.
 
 I wrote this as a fancy look up program.  there is also spell(1)
 which actually does spell checking on a file.  (I am not sure how 
 portable this is)
 - - - - - >8 - - - - - CUT - HERE - - - - - - - - - - - - - - - - - 
#! /bin/sh
td="/tmp/td$$"
lf="
"
here="`pwd`"


test "$#" '=' "0" -o '(' "$1" '=' "-h" -o "$1" '=' "-help" ')' &&
  echo "
  usage: $0 pattern ...

  a pattern consists of :
    letters 	match a..z, A..Z
    ?		wild, 1 unknown character
    *		wild, 0-or-more ?'s
    @		wild, 1-or-more vowels" &&
shift


mkdir $td; cd $td
for w in $* ; do
  ww="`echo $w | sed '/\?/s//\./g' | sed '/\*/s//\.\*/g' |
		 sed '/@/s//\[aeiouy\]\[aeiouy\]\*/g' `"
  echo ; echo " $ww :"
  grep "^$ww$" /usr/dict/words | head -100 | pr -t -w80 -5 2> /dev/null
done
cd $here; rmdir $td



More information about the Comp.unix.shell mailing list