>_ IzzyLab

Topic breakdown

The classic frequency-analysis task in Unix is solved with a pipeline (|) of small utilities, where each does one thing and passes the stream along. The key idea: uniq -c counts only consecutive identical lines, so it's always preceded by a sort to group them, and a final numeric descending sort brings the frequent values to the top. Extracting the right column from a line and stripping the counter is a job for awk; picking the top is for head. Mental model: a complex selection is assembled by composing simple filters, and the result is redirected into a file.

What's checked

  1. /root/top3.txt has exactly 3 lines
  2. the most frequent IP comes first
  3. the top-3 composition and order are correct

What it looks like