Format
fold [–bs]
[–w width] [–width]
[file…]
Description
fold reads
the standard input (stdin) or each file, if you specify any. Each
input line is broken into lines no longer than width characters.
If you do not specify width on the command
line, the default line length is 80. The output is
sent to the standard output (stdout).
Options
- –b
- Specifies width in bytes rather than
in column positions; that is, fold does
not interpret tab, backspace, and carriage return characters. If the
last byte specified by width is part of
a double-byte character, fold does not break
the character. Instead, the line is broken before the double-byte
character.
- –s
- Breaks each line at the last blank within width column
positions. If there is no blank that meets the requirement, fold breaks
the line normally.
- –w width
- Specifies a maximum line length of width characters.
- –width
- Is identical in effect to –w width.
Localization
fold uses
the following localization environment variables:
- LANG
- LC_ALL
- LC_CTYPE
- LC_MESSAGES
- NLSPATH
See Localization for more
information.
Exit values
- 0
- Successful completion
- 1
- Failure because the input file could not be opened
- 2
- Invalid command-line option or a missing width argument
Portability
POSIX.2, 4.2BSD.
The –width option
is an extension of the POSIX standard.