fold(1) fold(1)
NAME
fold - fold long lines
SYNOPSIS
fold [option ...] [file ...]
DESCRIPTION
fold reads the contents of text files or standard input and splits
(folds) long lines so that they do not exceed the default or specified
line width. The default line width is 80 characters per line. fold
splits lines by inserting a newline character.
The backspace, carriage-return and tab characters are treated spe-
cially in this case:
- Backspace decrements the character count by 1.
- Carriage-return resets the character count to 0.
- A tab character advances the character count to the next tab posi-
tion.
OPTIONS
No option specified:
fold splits the input lines so that no line exceeds a maximum
width of 80 characters (default).
-b (b - byte) fold counts bytes instead of characters. A line is
never split within a character.
-s (s - space) fold splits the line after the last character within
the maximum line length.
-w width
Defines the maximum width of a line, where width is the number of
characters or bytes per line.
width should be a multiple of 8 if tabs are present in the input
line.
-- If file begins with a dash (-), the end of the command-line
options must be marked with --.
file Name of the text file to be folded. You may name several such
files, in which case the specified options will be applied to
each file.
file not specified: fold reads from standard input.
Page 1 Reliant UNIX 5.44 Printed 11/98
fold(1) fold(1)
ERROR MESSAGES
Bad number for fold
This error message is displayed if you specify an invalid value for
width.
LOCALE
The LCMESSAGES environment variable governs the language in which
message texts are displayed. If LCMESSAGES is undefined or is defined
as the null string, it defaults to the value of LANG. If LANG is like-
wise undefined or null, the system acts as if it were not internation-
alized.
The LCALL environment variable governs the entire locale. LCALL
takes precedence over all the other environment variables which affect
internationalization.
EXAMPLES
Printing a file named notes on standard output.
The following result is obtained with the cat command:
$ cat
Notes:
Remind Carl to send in a bid within the next two weeks. The new deadline
for the evaluation of all bids is the end of June.
Using the fold command, you have the option of redefining the length
of the output lines.
The following command folds the contents of the notes file so that
each line has a maximum width of 40 characters:
$ fold -s -w 40 notes
Notes:
Remind Carl to send in a bid within the
next two weeks. The new deadline for the
evaluation of all bids is the end of
June.
SEE ALSO
cut(1), pr(1).
Page 2 Reliant UNIX 5.44 Printed 11/98