More command-line fun

Written By
Web Webster
Web Webster
Dec 30, 2010

“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

Complete
Story

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.