Skip to content

pdonis/wordcount

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

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.

Files Included

McIlroy's original 6-line shell pipeline is in wordcount.sh.

My Python solution to the same original problem is in wordcount.py.

My extended Python solution that correctly handles contractions is in ewordcount.py.

An extended shell pipeline that correctly handles contractions is in ewordcount.sh.

A test text file for use as input is in wordcounttest.txt.

The expected outputs of the two versions, when run on the test text file, are in wordcount.out and 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.

About

Python and shell solutions to the Knuth-McIlroy word count problem.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published