Name
fmt
Synopsis
fmt [options
] [files
]
Fill and join text, producing lines of roughly the same
length. (Unlike nroff, the
lines are not justified.) fmt
ignores blank lines and lines beginning with a dot (.
) or with “From:”. The emacs editor uses ESC-q
to join paragraphs, so fmt is useful for other editors, such as
vi. The following vi command fills and joins the remainder
of the current paragraph:
!}fmt
Solaris Options
-
-c
Don’t adjust the first two lines; align subsequent lines with the second line. Useful for paragraphs that begin with a hanging tag.
-
-s
Split long lines but leave short lines alone. Useful for preserving partial lines of code.
-
-w
n
Create lines no longer than n columns wide. Default is 72. (Can also be invoked as
-
n for compatibility with BSD.)
GNU/Linux Options
-c
,--crown-margin
Crown margin mode. Do not change indentation of each paragraph’s first two lines. Use the second line’s indentation as the default for subsequent lines.
-p
prefix
,--prefix=
prefix
Format only lines beginning with prefix.
-s
,--split-only
Suppress line-joining.
-t
,--tagged-paragraph
Tagged paragraph mode. Same as crown mode when the indentations of the first and second lines differ. If the indentation is the same, treat the first line as its own separate paragraph.
-u
,--uniform-spacing
Reduce spacing to a maximum of one space between words and two between sentences.
-w
width
,--width=
width
Set output width to width. The default is 75.
Mac OS X Options
-
-c
Center each line of text. Most other options are ...
Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.