Folds long lines for finite-width output device.
fold [ -b ] [ -s ] [ -w Width ] [ File... ]
The fold command is a filter that folds long lines for a finite-width output device. By default, the command folds the contents of standard input, breaking the lines to a line width of 80 (eighty). You can also specify one or more files as input to the command.
The fold command inserts a new-line character in the input lines so that each output line is as wide as possible without exceeding the value specified by the Width parameter. If the -b flag is specified, line width is counted in bytes. If the -b flag is not specified:
The fold command accepts -w Width values in multiples of 8 if the file contains tabs. To use other width values when the file contains tabs, use the expand command before using the fold command.
Notes:
This command returns the following
exit values:
0 | All input files processed successfully. |
>0 | An error occurred. |
To fold the lines of a file named longlines into width 72 (seventy-two), enter:
fold -w 72 longlines
/usr/bin/fold | Contains the fold command. |
The expand command, tab command.
Devices Overview for System Management in AIX 5L Version 5.1 System Management Concepts: Operating System and Devices.