Skip to content

Instantly share code, notes, and snippets.

@gojomo
Created October 6, 2015 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gojomo/0be4982ba2ba57cbc14b to your computer and use it in GitHub Desktop.
Save gojomo/0be4982ba2ba57cbc14b to your computer and use it in GitHub Desktop.
Count female/male pronouns in a plain-text file (here, Moby Dick from Project Gutenberg)
$ curl http://www.gutenberg.org/cache/epub/2701/pg2701.txt > moby-dick.txt
$ tr -cs "[:alpha:]" "\n" < moby-dick.txt | egrep "^(she|her|hers|herself)$" | wc -l
439
$ tr -cs "[:alpha:]" "\n" < moby-dick.txt | egrep "^(he|him|his|himself)$" | wc -l
5384
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment