Ordering a word-frequency pipeline

The file essay.txt contains lowercase words without punctuation, separated by spaces. Arrange the stages below so that, joined by pipes in the listed order, they print the three most frequent words in the essay, each preceded by its count.

  1. 1.

    sort

  2. 2.

    sort -rn

  3. 3.

    tr -s ' ' '\n' < essay.txt

  4. 4.

    uniq -c

  5. 5.

    head -n 3

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More The Shell Questions: