Skip to content

Instantly share code, notes, and snippets.

@jdmichaud
Last active May 22, 2017 12:15
Show Gist options
  • Save jdmichaud/502cbacaedfee8c7cbbb750a96d92fae to your computer and use it in GitHub Desktop.
Save jdmichaud/502cbacaedfee8c7cbbb750a96d92fae to your computer and use it in GitHub Desktop.
cat some_filename | \ # Open the file
tr [:blank:] '\n' | \ # transform whitespace into new line
tr '[:upper:]' '[:lower:]' | \ # Shift to lower case
sed 's/^[[:punct:]]*\([a-z]*\)[[:punct:]]*$/\1/g' | \ # Remove punctuation before and after words
grep '^[a-z]*$' | \ # Remove words containing punctuation
sort | \ # Sort
uniq -c | \ # Count
sort -rn | \ # Sort the count
less
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment