Linux Labs

First steps / Stage 9 of 15 · step 7 of 8

View and search inside files

easy ~15 min
Not running Starting usually ~20 s
Report a problem

Situation

The backup ran overnight, and its log is ~/backup.log. In the morning a colleague asks how the backup ended and whether there were any errors. More than one program writes to this log, and each records errors in its own way.

Task

Make it so that:

  1. ~/last.txt holds the last 5 lines of ~/backup.log;
  2. ~/errors.txt holds every log line with the word error in any case, exactly as it is written in the log;
  3. ~/count.txt holds the number of those lines, a single number.

Visible only to you. Saved as you type.

All notes

Lab goals

0 of 3
  • ~/last.txt holds the last five log lines — not checked yet
  • ~/errors.txt holds every line with the word error in any case — not checked yet
  • ~/count.txt holds the number of those lines — not checked yet

Hints

0 of 3 open · they open one at a time
Hint 1
Show the solution after 3 failed checks

Leave the lab?

The machine keeps running for 10 more minutes, then it is removed. Files are lost; completed goals stay.

Loading…