入力されたテキストを指定した幅で改行する「fold」コマンドの概要と使い方を記載しています。
RHEL Fedora CentOS Vine Deblan Ubuntu Plamo
参考サイト:Man page of INSTALL
概要・使用方法
入力ファイルを指定した場合の幅で改行して出力します。デフォルトでは80ですが、-wオプションで調整できます。
書式
$ fold [オプション] [ファイル名]
オプション
| -b –byte | バイト数で数える |
| -s –spaces | 空白位置で改行する |
| -w 幅 –width=幅 | 指定した幅に変更する(デフォルトは80) |
改行する幅を指定する
$ fold -w 幅 ファイル名
実行結果
[sunarin@localhost work]$ cat /usr/share/doc/coreutils-8.22/COPYING|head -n 10
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
[sunarin@localhost work]$ fold -w 30 /usr/share/doc/coreutils-8.22/COPYING|head -n 10
GNU GENERA
L PUBLIC LICENSE
Version
3, 29 June 2007
Copyright (C) 2007 Free Softw
are Foundation, Inc.
Everyone is permitted to copy
and distribute verbatim copie
[sunarin@localhost work]$
単語の途中で改行しないように幅を指定する
$ fold -w 幅 -s ファイル名
実行結果
[sunarin@localhost work]$ fold -w 30 -s /usr/share/doc/coreutils-8.22/COPYING|head -n 10
GNU
GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free
Software Foundation, Inc.
Everyone is permitted to
copy and distribute verbatim
[sunarin@localhost work]$

コメント