More command-line fun
Dec 29, 2010, 22:32 (2 Talkback[s])
(Other stories by Jesse Smith)
"This week I'd like to cover some command line tips and tricks.
There are a lot of tasks which can be completed with one or two
lines and I'd like to share a handful that I've found useful.
"Have you ever read a report that talked about the number of
times a given word appears in a story, a script or a play? You
might wonder if the report is correct about the number of times
Shakespeare used the term "love" in Romeo and Juliet. There is a
quick way to check. The following command will display a list of
the words that appear in a given file and a count of how many times
each word is used.
cat my_text_file.txt | tr -c a-zA-z ' ' | sed '/^$/d' | sort |
uniq -i -c