On Mon, 5 Mar 2007, Steve Litt wrote: > In preparation to create my index for my book, I created a Ruby program to > list every word in a file (in this case the .lyx file). > > Now of course this could be done with a simple one-liner using sed and > sort -u, but my program lists the words in 2 different orders, first in alpha > order, which of course could be done by the 1 liner, and then in descending > order of occurrence, which can't be.
fmt -1 | sort | uniq -c | sort -rn Also could had some tr and sed to clean out junk spacing and to lowercase everything. By the way, I did something similar when doing some indexing. Another thing I used is a spell checker -- words unknown to my dictionary I made sure were in the index. Jeremy C. Reed