Команда fold

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

Синтаксис

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

-bCount width in bytes rather than column positions.
-sIf 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 | -widthSpecify 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.
fileA path name of a text file to be folded. If no file operands are specified, the standard input will be used.

Примеры

fold -5 myfile.txt > newfile.txt

The above command would fold the lines of myfile.txt to 5 character width and re-route the results to the file newfile.txt

Обратно к списку команд