coreutils: fmt invocation
1
1 4.1 ‘fmt’: Reformat paragraph text
1 ==================================
1
1 ‘fmt’ fills and joins lines to produce output lines of (at most) a given
1 number of characters (75 by default). Synopsis:
1
1 fmt [OPTION]... [FILE]...
1
1 ‘fmt’ reads from the specified FILE arguments (or standard input if
1 none are given), and writes to standard output.
1
1 By default, blank lines, spaces between words, and indentation are
1 preserved in the output; successive input lines with different
1 indentation are not joined; tabs are expanded on input and introduced on
1 output.
1
1 ‘fmt’ prefers breaking lines at the end of a sentence, and tries to
1 avoid line breaks after the first word of a sentence or before the last
1 word of a sentence. A “sentence break” is defined as either the end of
1 a paragraph or a word ending in any of ‘.?!’, followed by two spaces or
1 end of line, ignoring any intervening parentheses or quotes. Like TeX,
1 ‘fmt’ reads entire “paragraphs” before choosing line breaks; the
1 algorithm is a variant of that given by Donald E. Knuth and Michael F.
1 Plass in “Breaking Paragraphs Into Lines”, ‘Software—Practice &
1 Experience’ 11, 11 (November 1981), 1119–1184.
1
11 The program accepts the following options. Also see ⇒Common
options.
1
1 ‘-c’
1 ‘--crown-margin’
1 “Crown margin” mode: preserve the indentation of the first two
1 lines within a paragraph, and align the left margin of each
1 subsequent line with that of the second line.
1
1 ‘-t’
1 ‘--tagged-paragraph’
1 “Tagged paragraph” mode: like crown margin mode, except that if
1 indentation of the first line of a paragraph is the same as the
1 indentation of the second, the first line is treated as a one-line
1 paragraph.
1
1 ‘-s’
1 ‘--split-only’
1 Split lines only. Do not join short lines to form longer ones.
1 This prevents sample lines of code, and other such “formatted” text
1 from being unduly combined.
1
1 ‘-u’
1 ‘--uniform-spacing’
1 Uniform spacing. Reduce spacing between words to one space, and
1 spacing between sentences to two spaces.
1
1 ‘-WIDTH’
1 ‘-w WIDTH’
1 ‘--width=WIDTH’
1 Fill output lines up to WIDTH characters (default 75 or GOAL plus
1 10, if GOAL is provided).
1
1 ‘-g GOAL’
1 ‘--goal=GOAL’
1 ‘fmt’ initially tries to make lines GOAL characters wide. By
1 default, this is 7% shorter than WIDTH.
1
1 ‘-p PREFIX’
1 ‘--prefix=PREFIX’
1 Only lines beginning with PREFIX (possibly preceded by whitespace)
1 are subject to formatting. The prefix and any preceding whitespace
1 are stripped for the formatting and then re-attached to each
1 formatted output line. One use is to format certain kinds of
1 program comments, while leaving the code unchanged.
1
1 An exit status of zero indicates success, and a nonzero value
1 indicates failure.
1