UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 29.2 Check Spelling Interactively with ispell Chapter 29
Spell Checking, Word Counting, and Textual Analysis
Next: 29.4 Inside spell
 

29.3 How Do I Spell That Word?

If you aren't sure which of two possible spellings is right, you can use the spell command with no arguments to find out. Type the name of the command, followed by a RETURN, then type the alternative spellings you are considering. Press CTRL-d (on a line by itself) to end the list. The spell command will echo back the word(s) in the list that it considers to be in error:

$ spell
misspelling
mispelling
[CTRL-d]
mispelling

You can invoke spell in this way from within vi, by typing:

:! 


!spell
misspelling
mispelling
[CTRL-d]
mispelling
[Hit return to continue]

If you're using ispell (29.2), you need to add the -l option, since ispell doesn't read from standard input by default. (Even -l doesn't let ispell read from a pipe. The purpose of this option is to let you type in a list of words, just as shown above for spell; when you end the list, ispell will echo back the misspelled word, just like spell. There's no additional functionality there, except that ispell will use its local dictionaries and improved spelling rules.)

An even better way to do the same thing may be with look (27.18). With just one argument, look searches the system word file, /usr/dict/words, for words starting with the characters in that one argument. That's a good way to check spelling or find a related word:

% look help
help
helpful
helpmate

look uses its -df options automatically when it searches the word list. -d ignores any character that isn't a letter, number, space or tab; -f treats uppercase and lowercase letters the same.

- DD, JP


Previous: 29.2 Check Spelling Interactively with ispell UNIX Power ToolsNext: 29.4 Inside spell
29.2 Check Spelling Interactively with ispell Book Index29.4 Inside spell

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System