Signal9Signal9 — home
online
back to labs

Awk: Built-in Variable NR

MediumSed & Awk5-10 min
The brief

Number every line of /root/work/notes.txt into /root/work/out.txt.

Each output line must be the line's number, then a colon and a space, then the original line unchanged — so the first becomes '1: ...' and the second '2: ...'.

Grading compares against that exact numbering.

What you'll do
  • Prefix each line with its line number, a colon and a space
  • Save the numbered lines 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.