Fold lines (POSIX)
fold [-bs] [-w width] [file...]
Neutrino
The fold filter folds lines in files by breaking up lines that have a width in excess of 80 or, if specified, the width in the command-line -w option. Lines are folded by the insertion of a newline character. All output is written to the standard output.
In all cases, the current count of line width is reset to zero when a newline character is encountered in the input. In addition, when the -b option is not specified, the following characters have a special meaning when encountered in the input:
Fold the file myfile.txt to a maximum line width of 80 characters, making the line breaks on the last word boundary (white space) before the width was exceeded and write the results to the standard output:
fold -s myfile.txt
Fold the file myfile.txt to a width of 40 characters, and treat all characters except newline as occupying one character (byte) position and write the results to the standard output:
fold -bw40 myfile.txt
If no files are specified on the command line, fold reads lines to be folded from the standard input until EOF is reached.
The fold utility writes all folded output from all input files to the standard output.
If an error occurs, a diagnostic message is written to the standard error.
The fold utility reads lines from the text files specified on the command line. If the -b is specified, the input files need not be text files.