More shell, less egg – All this

bash: 1:  tr -cs A-Za-z '\n' | 2:  tr A-Z a-z | 3:  sort | 4:  uniq -c | 5:  sort -rn | 6:  sed ${1}q

“Read a file of text, determine the n most frequently used words, and print out a sorted list of those words along with their frequencies.” — by the guy who invented pipes.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s