[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    fmt(1) manual page Table of Contents

Name

fmt - simple text formatters

Synopsis

fmt [ -c ] [ -s ] [ -w width | -width ] [ inputfile... ]

Availability

SUNWcsu

Description

fmt is a simple text formatter that fills and joins lines to produce output lines of (up to) the number of characters specified in the -w width option. The default width is 72. fmt concatenates the inputfiles listed as arguments. If none are given, fmt formats text from the standard input.

Blank lines are preserved in the output, as is the spacing between words. fmt does not fill lines beginning with a ‘.’ (dot), for compatibility with nroff(1) . Nor does it fill lines starting with ‘From:’.

Indentation is preserved in the output, and input lines with differing indentation are not joined (unless -c is used).

fmt can also be used as an in-line text filter for vi(1) ; the vi command:

!}fmt

reformats the text between the cursor location and the end of the paragraph.

Options

-c
Crown margin mode. Preserve the indentation of the first two lines within a paragraph, and align the left margin of each subsequent line with that of the second line. This is useful for tagged paragraphs.
-s
Split lines only. Do not join short lines to form longer ones. This prevents sample lines of code, and other such formatted text, from being unduly combined.
-w width | -width
Fill output lines to up to width columns.

Environment

If any of the LC_* variables ( LC_CTYPE, LC_MESSAGES, LC_TIME, LC_COLLATE, LC_NUMERIC, and LC_MONETARY ) (see environ(5) ) are not set in the environment, the operational behavior of fmt for each corresponding locale category is determined by the value of the LANG environment variable. If LC_ALL is set, its contents are used to override both the LANG and the other LC_* variables. If none of the above variables is set in the environment, the "C" (U.S. style) locale determines how fmt behaves.
LC_CTYPE
Determines how fmt handles characters. When LC_CTYPE is set to a valid value, fmt can display and handle text and filenames containing valid characters for that locale. fmt can display and handle Extended Unix Code (EUC) characters where any individual character can be 1, 2, or 3 bytes wide. fmt can also handle EUC characters of 1, 2, or more column widths. In the "C" locale, only characters from ISO 8859-1 are valid.

See Also

nroff(1) , vi(1)

Notes

The -width option is acceptable for BSD compatibility, but it may go away in future releases.


Table of Contents