Menu
Coddy logo textTech

Generating A Report

Part of the Fundamentals section of Coddy's Terminal journey — lesson 52 of 82.

challenge icon

Challenge

Easy

You've analyzed the log file, filtered errors, and counted them. Now it's time to save your findings to a report file that can be shared or reviewed later.

Create a file called report.txt that contains a summary of the log analysis. Use redirection to write the following information to the file:

  1. First, write the text === Log Analysis Report === to report.txt
  2. Append the text Total errors found: followed by the error count (use a pipeline with grep and wc -l)
  3. Append the text === Error Details ===
  4. Append all the ERROR lines from server.log

Then display the contents of report.txt using cat.

echo "=== Log Analysis Report ===" > report.txt
echo "Total errors found: $(grep ERROR server.log | wc -l)" >> report.txt
echo "=== Error Details ===" >> report.txt
grep ERROR server.log >> report.txt
cat report.txt

Congratulations! You've completed the Log Analyzer Project. You've learned to view, filter, count, and report on log data using pipes and redirection - essential skills for any system administrator or developer.

Try it yourself

Terminal
grep "ERROR" server.log | wc -l

All lessons in Fundamentals