Signal9Signal9 — home
online
back to labs

Awk: BEGIN and END Blocks

MediumSed & Awk5-10 min
The brief

Produce a report of /root/work/items.txt (one item per line) into /root/work/out.txt: a header line, the items, then a footer count. Exactly.

The output must be the header '=== ITEMS ===', then each item line unchanged, then 'total: N' where N is the line count.

Grading compares against that.

What you'll do
  • Emit a header line, then the items unchanged, then a total count
  • Save the full report to /root/work/out.txt

Hands-on lab: you work on a real Linux box in your browser, graded on the machine's actual state.