FunctionRacerProblemsRace

Busiest Visitors

HardBasha shell script

Each line of access.log is a visitor, a page and a status code, with spaces between them: 10.0.0.7 /home 200. Print the three visitors with the most lines, the busiest first, each as its count, a space, and the visitor: 5 10.0.0.7. Visitors with the same count go in order of their name, as text.

Example 1

access.log
10.0.0.7 /home 200
10.0.0.9 /cart 200
10.0.0.7 /cart 500
10.0.0.2 /home 200
10.0.0.7 /pay 200
10.0.0.9 /home 404
10.0.0.4 /home 200
prints
3 10.0.0.7
2 10.0.0.9
1 10.0.0.2

Constraints

Race itor take your time

Write it in your browser, against the clock. The model script, with a note on each command it uses, comes after.

More Bash problems