NAME
fold - wrap each input line to fit specified width
SYNOPSIS
fold [-bs] [-w width] [file ...]
DESCRIPTION
The fold command reads lines from the specified files (or standard input if none are specified) and writes them to the standard output with newlines inserted into lines longer than the specified column width.
The default column width is 80, but this may be overridden using the -w flag. For historical reasons, the width may be specified directly, as in fold -72
, omitting the -w.
The -s flag causes breaks to occur after whitespace rather than in the middle of a word. This produces a ragged right edge, but is much nicer to look at.
The -b flag makes the program ignore embedded backspaces, tabs, and carriage returns when deciding where to split. This makes it run about thirty times faster. You might want to get used to using -b.
Current locale settings will be honored in determining what is meant by "whitespace" and "word characters".
BUGS
POSIX 1003.2 states that a newline will never be inserted immediately before or after a backspace or a carriage return, but this is not checked for.
SEE ALSO
expand(1), fmt(1)
AUTHORS
Clinton Pierce and Tom Christiansen.
This code is freely modifiable and freely redistributable under Perl's Artistic License.