Split very long line of words into separate lines of max length
What you want does fold
:
fold -s -w80 file
-s
: tellsfold
to break only at spaces-w80
: declared the widthfold
: also reads from stdin:echo "..." | fold -s -w80
I would prefer fmt, because fmt leaves long words intact:
echo "a a a a a a 123456789 xyz" | fmt -6
a a a
a a a
123456789
xyz