The Wordcount Problem
Here are some scripts relating to the "word count problem" that was the subject of a memorable exchange between Donald Knuth and Doug McIlroy. See here for context.
McIlroy's original 6-line shell pipeline is in
My Python solution to the same original problem is in
My extended Python solution that correctly handles contractions is in
An extended shell pipeline that correctly handles contractions is in
A test text file for use as input is in
The expected outputs of the two versions, when run on the test text
file, are in
ewordcount.out. Note that the
outputs include all of the words in the file; I generated them by
using a large number (150) as the argument to each script.