Skip to content

Instantly share code, notes, and snippets.

@nvictor
Last active August 29, 2022 16:24
Show Gist options
  • Select an option

  • Save nvictor/0949aabfcddcecc3f27b2b34fe16ad8c to your computer and use it in GitHub Desktop.

Select an option

Save nvictor/0949aabfcddcecc3f27b2b34fe16ad8c to your computer and use it in GitHub Desktop.
top_words.sh
# basic
cat **/*.txt | tr -sc "[:alnum:]" "\n" | tr "[:upper:]" "[:lower:]" | sort | uniq -c | sort -nr | head -10
# remove stop / common words
cat **/*.txt | tr -sc "[:alnum:]" "\n" | tr "[:upper:]" "[:lower:]" | fgrep --word-regexp --invert-match --file common_words.txt | sort | uniq -c | sort -nr | head -10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment