FOLD(1) | General Commands Manual | FOLD(1) |
fold
— fold long
lines for finite width output device
fold |
[-bs ] [-w
width] [file ...] |
fold
is a filter which folds the contents
of the specified files, or the standard input if no files are specified,
breaking the lines to have a maximum of 80 display columns.
The options are as follows:
-b
-s
-w
widthUnless -b
is specified, a backspace
character decrements the column position by one, a carriage return resets
the column position to zero, and a tab advances the column position to the
next multiple of eight.
The fold
utility exits 0 on
success, and >0 if an error occurs.
The fold
utility is compliant with the
IEEE Std 1003.1-2008 (“POSIX.1”)
specification.
The fold
utility first appeared in
1BSD. It was rewritten for
4.3BSD-Reno to improve speed and modernize style.
The -b
and -s
options were
added to NetBSD 1.0 for IEEE Std
1003.2 (“POSIX.2”) compliance.
Bill Joy wrote the original version of
fold
on June 28, 1977. Kevin
Ruddy rewrote the command in 1990, and J. T.
Conklin added the missing options in 1993.
Traditional roff(7) output
semantics, implemented both by GNU nroff and by
mandoc(1), only uses a single backspace
for backing up the previous character, even for double-width characters. The
fold
backspace semantics required by POSIX
mishandles such backspace-encoded sequences, breaking lines early. The
fmt(1) utility provides similar
functionality and does not suffer from that problem, but isn't standardized
by POSIX.
October 24, 2016 | OpenBSD-current |