Signal9Signal9 — home
online
back to labs

Dojo: The Longest Line

HardOne-Liner Dojo10-15 min
The brief

The file /root/prose.txt has lines of different lengths. In ONE line, find the SINGLE longest line and write it (its text only) to /root/answer.txt.

There's no 'longest line' command — you compose one. awk can prefix each line with its length; sort numerically, take the top, then strip the length back off. Spicy, but it's just the pipeline pattern again.

What you'll do
  • Write the longest line of /root/prose.txt to /root/answer.txt, in one line

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