Skip to content
Justice Tech School

Practice: Count Words

Pipe text through standard tools.

Example
text="the cat and the hat and the bat"
echo "$text" | tr " " "\n" | sort | uniq -c | sort -rn | head -n 3

Result

      3 the
      2 and
      1 hat

Exercise

Count unique words.

sort | uniq 

Quiz Test

What does the pipeline show?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.