あなたが望むことは fold です :
fold -s -w80 file
-s:foldを伝えます スペースでのみ改行する-w80:宣言された幅fold:stdin からも読み取ります:echo "..." | fold -s -w80
fmt は長い単語をそのまま残すので、fmt の方がいいと思います:
echo "a a a a a a 123456789 xyz" | fmt -6
a a a
a a a
123456789
xyz
あなたが望むことは fold です :
fold -s -w80 file
-s :fold を伝えます スペースでのみ改行する-w80 :宣言された幅fold :stdin からも読み取ります:echo "..." | fold -s -w80 fmt は長い単語をそのまま残すので、fmt の方がいいと思います:
echo "a a a a a a 123456789 xyz" | fmt -6
a a a
a a a
123456789
xyz