Signal9Signal9 — home
online
back to labs

Dojo: Squeeze Repeated Spaces

EasyOne-Liner Dojo8 min
The brief

The file /root/messy.txt has runs of multiple spaces where there should be one. In ONE line, collapse every run of spaces down to a single space and write the cleaned text to /root/answer.txt.

This is exactly what tr's squeeze does — no sed regex needed. Squeeze repeats of the space character.

What you'll do
  • Write /root/messy.txt with runs of spaces collapsed to one, 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.