fold

将输入行换行以适合指定的宽度,将每个FILE(“ - ”表示标准输入)或标准输入(如果没有给出)写入标准输出,打破长行

语法

  fold [options]... [FILE]...

默认情况下,`fold’会打破超过80列的行。输出根据需要分成多行

`fold’默认计算屏幕列; 因此,Tab可以计算多个列,Backspace会减少列数,CarriageReturn会将列设置为零。

选项


 -b
 --bytes
以Byte为单位计算列宽,而非采用行数编号为单位

 -s
 --spaces
以空格字符作为换列点

 -w WIDTH
 --width=WIDTH
设置每列的最大行数

fold 命令实例:

linux命令:fold -s <filename> <filename> -s fold fold -s <filename>rootopen.com
linux命令:fold -s <filename> <filename> -s fold fold -s <filename>rootopen.com
2018-01-07 14:21:48

linux命令:fold -s -w 90 file.txt file.txt 90 -w -s fold fold -s -w 90 file.txtrootopen.com
linux命令:fold -s -w 90 file.txt file.txt 90 -w -s fold fold -s -w 90 file.txtrootopen.com
2018-01-02 08:31:48

linux命令:fold -w 78 -s file-to-wrap file-to-wrap -s 78 -w fold fold -w 78 -s file-to-wraprootopen.com
linux命令:fold -w 78 -s file-to-wrap file-to-wrap -s 78 -w fold fold -w 78 -s file-to-wraprootopen.com
2018-01-21 07:13:48

linux命令:fold -w 1 <file> | grep -c <character> <character> -c grep | <file> 1 -w fold fold -w 1 <file> | grep -c <character>rootopen.com
linux命令:fold -w 1 <file> | grep -c <character> <character> -c grep | <file> 1 -w fold fold -w 1 <file> | grep -c <character>rootopen.com
2018-04-28 13:21:48

linux命令:folder=0;mkdir $folder; while find -maxdepth 1 -type f -exec mv "{}" $folder \; -quit ; do if [ $( ls $folder | wc -l ) -ge 100 ]; then folder=$(( $folder + 1 )); mkdir $folder; fi ; done done ; fi $folder; mkdir )); 1 + $folder folder=$(( then ]; 100 -ge ) -l wc | $folder ls $( [ if do ; -quit \; $folder "{}" mv -exec f -type 1 -maxdepth find while $folder; folder=0;mkdir folder=0;mkdir $folder; while find -maxdepth 1 -type f -exec mv "{}" $folder \; -quit ; do if [ $( ls $folder | wc -l ) -ge 100 ]; then folder=$(( $folder + 1 )); mkdir $folder; fi ; donerootopen.com
linux命令:folder=0;mkdir $folder; while find -maxdepth 1 -type f -exec mv "{}" $folder \; -quit ; do if [ $( ls $folder | wc -l ) -ge 100 ]; then folder=$(( $folder + 1 )); mkdir $folder; fi ; done done ; fi $folder; mkdir )); 1 + $folder folder=$(( then ]; 100 -ge ) -l wc | $folder ls $( [ if do ; -quit \; $folder "{}" mv -exec f -type 1 -maxdepth find while $folder; folder=0;mkdir folder=0;mkdir $folder; while find -maxdepth 1 -type f -exec mv "{}" $folder \; -quit ; do if [ $( ls $folder | wc -l ) -ge 100 ]; then folder=$(( $folder + 1 )); mkdir $folder; fi ; donerootopen.com
2018-05-27 23:51:48

linux命令:fold -sw 20 <(echo "Long Text to be wrapped with \"\n\"") |sed ':a;N;$!ba;s/ *\n/\\n/g' *\n/\\n/g' ':a;N;$!ba;s/ |sed \"\n\"") with wrapped be to Text "Long <(echo 20 -sw fold fold -sw 20 <(echo "Long Text to be wrapped with \"\n\"") |sed ':a;N;$!ba;s/ *\n/\\n/g'rootopen.com
linux命令:fold -sw 20 <(echo "Long Text to be wrapped with \"\n\"") |sed ':a;N;$!ba;s/ *\n/\\n/g' *\n/\\n/g' ':a;N;$!ba;s/ |sed \"\n\"") with wrapped be to Text "Long <(echo 20 -sw fold fold -sw 20 <(echo "Long Text to be wrapped with \"\n\"") |sed ':a;N;$!ba;s/ *\n/\\n/g'rootopen.com
2018-04-03 11:58:48

Linux的Bash命令行(A-Z排序)