Step 7 of 8 · lab · 15 min
View and search inside files
The end of a nightly log, its error lines and their count, each in its own file: tail and grep.
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:
~/last.txtholds the last 5 lines of~/backup.log;~/errors.txtholds every log line with the worderrorin any case, exactly as it is written in the log;~/count.txtholds the number of those lines, a single number.
Lab · on your own
No commands are given in this lab: type them in the terminal yourself. Goals are checked on the machine after every command.
Goals
0 of 3-
~/last.txt holds the last five log lines — not done yet
-
~/errors.txt holds every line with the word error in any case — not done yet
-
~/count.txt holds the number of those lines — not done yet
Ctrl+Enter
Starts the machine node1 · Ubuntu 24.04
The machine is starting
Hints
0 of 3Lab goals
0 of 3-
~/last.txt holds the last five log lines — not done yet
-
~/errors.txt holds every line with the word error in any case — not done yet
-
~/count.txt holds the number of those lines — not done yet
Goals are checked on the machine after every command.