Fold

来自WordPress中文文档
跳转至: 导航搜索

Linux命令:fold

功能说明:限制文件列宽。
语  法:fold [-bs][-w<每列行数>][--help][--version][文件...]
补充说明:fold指令会从指定的文件里读取内容,将超过限定列宽的列加入增列字符后,输出到标准输出设备。若不指定任何文件名称,或是所给予的文件名为“-”,则fold指令会从标准输入设备读取数据。
参  数:
 -b或--bytes   以Byte为单位计算列宽,而非采用行数编号为单位。
 -s或--spaces   以空格字符作为换列点。
 -w<每列行数>或--width<每列行数>   设置每列的最大行数。
 --help   在线帮助。
 --version   显示版本信息。


英文版本,欢迎翻译:

ABOUT FOLD

Filter for folding lines. This breaks the lines to have a maximum of x width column position (or bytes).

SYNTAX

fold [ -bs ] [-w width | -width] [file]

-b Count width in bytes rather than column positions. -s If a segment of a line contains a blank character within the first width column positions (or bytes), break the line after the last such blank character meeting the width constraints. If there is no blank character meeting the requirements, the -s option will have no effect for that output segment of the input line. -w width | -width Specify the maximum line length, in column positions (or bytes if -b is specified). If width is not a positive decimal number, an error is returned. The default value is 80. file A path name of a text file to be folded. If no file operands are specified, the standard input will be used.

EXAMPLES

fold -5 myfile.txt > newfile.txt - Would fold the lines of myfile.txt to 5 character width and re-route the results to the file newfile.txt