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 ():

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

- TOR, JP