Unique Word Counter Needed

Darin Adler darin at ut-dillo.UUCP
Fri Dec 13 18:26:05 AEST 1985


<>

Here is the method I normally use to count words:

tr A-Z a-z | tr -cs -a-z0-9\'\" '\012' | sort -u | wc -l

The first "tr" command take care of capitalization.  The second "tr" command
separates the file into a word per line (where a word is a sequence of
characters [-A-Za-z0-9'"]).  The "sort" command eliminates duplicates and
the "wc" gives us the number of lines in the result.
-- 
Darin Adler	{gatech,harvard,ihnp4,seismo}!ut-sally!ut-dillo!darin

"Such a mass of motion -- do not know where it goes"	P. Gabriel



More information about the Comp.unix mailing list