Creating Shakespearean n-grams with just the command-line and regexes
gist.github.com
gist.github.com
Have you heard of "Unix for Poets"? It also focuses on command line programs to pick up n-grams. There is also a segment on C.
Link: https://web.stanford.edu/class/cs124/kwc-unix-for-poets.pdf