File: fmt.1

package info (click to toggle)
textutils 1.22-2.4
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 6,480 kB
  • ctags: 2,942
  • sloc: ansic: 31,755; sh: 8,186; perl: 811; makefile: 640; sed: 93
file content (118 lines) | stat: -rw-r--r-- 3,310 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
.TH FMT 1 "GNU Text Utilities" "FSF" \" -*- nroff -*-
.SH NAME
fmt \- simple optimal text formatter 
.SH SYNOPSIS
.B fmt
[\-cstu] 
[\-width] 
[\-w width] 
[\-p prefix]
[\-\-crown-margin]
[\-\-split-only]
[\-\-tagged-paragraph]
[\-\-uniform-spacing]
[\-\-width=width]
[\-\-prefix=prefix]
[\-\-help]
[\-\-version]
[file ...]
.SH DESCRIPTION
This documentation is no longer being maintained and may be inaccurate
or incomplete.  The Texinfo documentation is now the authoritative source.
.PP
This manual page documents the GNU version of
.BR fmt .
.B fmt
is a simple text formatter that
fills and joins lines to produce output lines of (up to) the specified
.I width
(default 75).
However
.B fmt
uses a 
.B best-fit 
line breaking algorithm, by a simple version of
\*(lqBreaking Paragraphs into Lines\*(rq,
Donald E. Knuth and Michael F. Plass,
.I "Software\(emPractice and Experience"
.B 11
(1981) 1119\-1184.
.LP
.B fmt
concatenates the
.IR file s
listed as arguments.  If none are given,
.B fmt
formats text from the standard input.
.LP
Blank lines are preserved in the output, as is the spacing between words
(unless
.I \-u
is used).
In contrast to BSD
.BR fmt ,
tabs are expanded on input and re-introduced on output.
.LP
Indentation is preserved in the output, and input lines with differing
indentation are not joined (unless
.I \-c
or
.I \-t
is used).
Note that although the BSD
.B fmt
manual also states this,
the BSD version does in fact join following lines with less indentation.
.LP
.B fmt 
prefers breaking lines at the end of a sentence,
and tries to avoid line breaks after the first word of a sentence
or before the last word of a sentence.
A sentence break is defined as either the end of a paragraph or a word ending
in [.?!], followed by two spaces or end of line,
ignoring any intervening parentheses or quotes.
.SS OPTIONS
.TP
.I "-c, --crown-margin"
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.
.TP
.I "-t, --tagged-paragraph"
Tagged paragraph mode:
just like crown mode, except that
the indentation of the first line of a paragraph must be different
from the indentation of the second.
Otherwise the first line is treated as a one-line paragraph.
.TP
.I "-s, --split-only"
Split lines only.  Do not join short lines to form longer ones.
This prevents sample lines of code, and other such \*(lqformatted\*(rq text,
from being unduly combined.
.TP
.I "-u, --uniform-spacing"
Uniform spacing.
Reduce spacing between words to one space, except at the end of a sentence
(two spaces).
.TP
.I "-width, -w width, --width=width"
Fill output lines to up to 
.IR width " columns"
(default 75).
.B fmt 
prefers to make lines about 7% shorter, to give it room to balance line
lengths.
.TP
.I "-p, --prefix=prefix"
Only lines beginning with the prefix (possibly preceded by white
space) are re-arranged; the prefix (with any preceding white
space) is stripped for the formatting and re-attached to each
formatted output line.
One use is to format certain kinds of program comments,
while leaving the code unchanged.
.TP
.I "\-\-help"
Print a usage message and exit with a status code indicating success.
.TP
.I "\-\-version"
Print version information on standard output then exit.