fmtsimple text formatter |
Command |
fmt
[-bCcjns
]
[-l
n]
[-p
n]
[-w
n]
[file ...]
fmt
is a simple text formatter intended for modest tasks
such as formatting mail messages and use within the Vi family of text editors.
Formatted output is written to the standard output. fmt
reads input from the file arguments on the command line; when there are
none of these, it reads from the standard input.
In the output, white space at the beginning of a line consists of tab characters
and blanks. White space in the middle of a line is always spaces (which means
that fmt
converts tabs to spaces).
Normally, fmt
ignores line breaks in input, filling output
lines. For example,
becomesMary had a little lamb Its fleece was white as snow
However, blank lines, changes in indent and input lines starting with a dot (Mary had a little lamb Its fleece was white as snow
.
) do cause a break. In this way,
nroff
/
troff
files are preserved.
-b
assumes block paragraphs (that is, paragraphs are uniformly indented, including first line) and breaks lines on every change of input indentation.
-C
centers the input lines. fmt
ignores the
indentation of input lines.
-c
assumes crown paragraphs (that is, paragraphs start with a line with a negative indent (every line but the first is indented)) and therefore breaks on a decrease in indentation only.
-j
produces a justified right margin by inserting extra blanks into output lines as necessary.
-l
nsets the maximum line length to n characters. By default,
fmt
produces output lines of at most 72 characters. If
n equals 0, there is no maximum line length, so paragraphs are
output as a single long line. This format is useful as input to word
processors which use soft returns within paragraphs and hard returns to
terminate paragraphs..
-n
ignores indent and inter-word space of input lines and squeezes
multiple spaces into one. Normally, fmt
preserves
indentation and inter-word spacing of input lines on output.
-p
nsets the output page offset to n characters (default 0).
fmt
adds this offset to the prevailing line
indent.
-s
does not join short lines to form longer lines. This prevents sample lines of code and other such formatted text from being combined unduly.
-w
nis identical to the -l
n option. A value of
0 of n has the same meaning: there is no limit to the maximum line
length.
0
Successful completion.
1
Failure due to any of the following
-l
or
-w