fmt
1 名前の由来
2 よく使う形
$ printf 'this is a long line that should wrap when formatted with fmt to a narrow width for testing purposes here\n' > longline.txt; fmt -w 20 longline.txt$ printf 'this is a long line that should wrap when formatted with fmt to a narrow width for testing purposes here\n' > longline.txt; fmt -w 20 longline.txt | wc -l$ printf 'short line\n' | fmt3 主な選択肢
-w WIDTH, --width=WIDTHfmt -w 40 f.txt-u, --uniform-spacingfmt -u f.txt-s, --split-onlyfmt -s f.txt4 落とし穴
fmtは空行区切りの「段落」を単位に詰め直す——箇条書きや表のように改行そのものに意味がある文章に使うと崩れる。 既定の折り返し幅は75桁。ソースコードのように改行に意味がある内容には向かない。
5 環境差
GNU / Linux
BSD / macOS