NAME [Toc] [Back]
fold - fold long lines for finite width output device
SYNOPSIS [Toc] [Back]
fold [-b] [-s] [-w width] [file ...]
fold [-s] [-width] [file ...]
DESCRIPTION [Toc] [Back]
The fold command is a filter that folds the contents of the specified
files, breaking the lines to have a maximum of width column positions
(or bytes, if the -b option is specified). The fold command breaks
lines by inserting a newline character so that each output line is the
maximum width possible that does not exceed the specified number of
column positions (or bytes). A line cannot be broken in the middle of
a character. If no files are specified or if a file name of - is
specified, the standard input is used.
The fold command is often used to send text files to line printers
that truncate, rather than fold, lines wider than the printer is able
If the backspace, tab, or carriage-return characters are encountered
in the input, and the -b option is not specified, they are treated
specially as follows:
Backspace The current count of line width is decremented
by one, although the count never becomes
negative. Thus, the character sequence
character-backspace-character counts as using
one column position, assuming both characters
each occupy a single column position. fold does
not insert a newline character immediately
before or after any backspace character.
Tab Each tab character encountered advances the
column position pointer to the next tab stop.
Tab stops are set 8 columns apart at column
positions 1, 9, 17, 25, 33, etc.
Carriage-return The current count of line width is set to zero.
fold does not insert a newline character
immediately before or after any carriage-return
Note that fold may affect any underlining that is present.
Options [Toc] [Back]
The fold command recognizes the following options and command-line
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
-b Count width in bytes rather than in column
-s Break the line on the last blank character found
before the specified number of column positions
(or bytes). If none are found, break the line
at the specified line length.
-w width Specify the maximum line length, in column
-width positions (or bytes if -b is specified). The
default value is 80. width should be a multiple
of 8 if tabs are present, or the tabs should be
expanded using expand before processing by fold
(see expand(1)). The -width option is
obsolescent and may be removed in a future
EXTERNAL INFLUENCES [Toc] [Back]
LC_CTYPE determines the interpretation of text as single- and/or
LC_MESSAGES determines the language in which messages are displayed.
If LC_CTYPE or LC_MESSAGES is not specified in the environment or is
set to the empty string, the value of LANG is used as a default for
each unspecified or empty variable. If LANG is not specified or is
set to the empty string, a default of "C" (see lang(5)) is used
instead of LANG.
If any internationalization variable contains an invalid setting, fold
behaves as if all internationalization variables are set to "C". See
International Code Set Support [Toc] [Back]
Single- and multi-byte character code sets are supported.
SEE ALSO [Toc] [Back]
STANDARDS CONFORMANCE [Toc] [Back]
fold: XPG4, POSIX.2
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003 [ Back ]