Полезная информация

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 29.7 Count How Many Times Each Word Is Used Chapter 29
Spell Checking, Word Counting, and Textual Analysis
Next: 29.9 Looking for Closure
 

29.8 Find a a Doubled Word

sh_init
csh_init
One type of error that's hard to catch when proofreading is a doubled word. It's hard to miss the double "a" in the title of this article, but you might find yourself from time to time with a "the" on the end of one line and the beginning of another.

We've seen awk scripts to catch this, but nothing so simple as this shell function. Here are two versions; the second is for the System V version of tr (35.11):

uniq 

ww() { cat $* | tr -cs "a-z'" "\012" | uniq -d; }

ww() { cat $* | tr -cs "[a-z]'" "[\012*]" | uniq -d; }

- TOR, JP


Previous: 29.7 Count How Many Times Each Word Is Used UNIX Power ToolsNext: 29.9 Looking for Closure
29.7 Count How Many Times Each Word Is Used Book Index29.9 Looking for Closure

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