fmt(1) fmt(1)
NAME
fmt - simple text formatter
SYNOPSIS
fmt [option ...] [file] ...
DESCRIPTION
fmt is a simple text formatter which can be used to format text files
or text read in from the standard input. It is capable of splitting,
joining, and filling lines to produce output lines of a specified
length. The result is written to standard output.
OPTIONS
No option specified:
fmt joins and splits input lines to produce output lines of up to
72 characters and writes the new lines to standard output.
-c (crown margin mode) fmt preserves the indentation of the first
two lines within a paragraph and aligns the left margin of each
subsequent line within the paragraph with that of the second
line. This option is useful for multiple tagged paragraphs.
-s (split lines only) fmt does not join short lines to form longer
ones. This prevents sample lines of program code, and other such
formatted text, from being inappropriately combined.
-w width
Output lines are to be up to width columns long. If this option
is not specified, fmt produces output lines with a default width
of 72 characters.
file Name of the text file to be reformatted. You may name more than
one file; in this case the fmt options you specify are applied to
all files, and all the files are concatenated.
file not specified:
fmt reads from standard input.
Mode of operation
Indentation is preserved in the output, and input lines with differing
indentation are not joined (unless the -c option is used).
Blank lines and the spacing between words are preserved in the output.
Words longer than width characters are not split. The maximum permis-
sible line length is exceeded in this case.
Lines beginning with a . (dot) are not filled by fmt (for compatibil-
ity with nroff).
Page 1 Reliant UNIX 5.44 Printed 11/98
fmt(1) fmt(1)
Lines starting with "From:", e.g. header lines in mail (see mail), are
also preserved.
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
The file named text is displayed first in its original state with the
cat command and then formatted to a width of 40 columns with fmt:
$ cat text
It is evening, and time for the flowers to close
their petals. Give me leave to sit
by your side and bid my lips do the work that can
be done in silence,
and in the dim light of the stars.
$ fmt -w 40 text
It is evening, and time for the flowers
to close their petals. Give me leave to
sit by your side and bid my lips do the
work that can be done in silence, and in
the dim light of the stars.
SEE ALSO
vi(1), nroff(1M).
Page 2 Reliant UNIX 5.44 Printed 11/98