Deleted Added
full compact
fmt.1 (57847) fmt.1 (77807)
1.\" Copyright (c) 1980, 1990, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)fmt.1 8.1 (Berkeley) 6/6/93
1.\" Copyright (c) 1980, 1990, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)fmt.1 8.1 (Berkeley) 6/6/93
33.\" $FreeBSD: head/usr.bin/fmt/fmt.1 57847 2000-03-09 09:27:40Z sheldonh $
33.\" $FreeBSD: head/usr.bin/fmt/fmt.1 77807 2001-06-06 10:17:05Z ru $
34.\"
34.\"
35.Dd June 6, 1993
35.\" Modified by Gareth McCaughan to describe the new version of `fmt'
36.\" rather than the old one.
37.Dd June 25, 2000
36.Dt FMT 1
37.Os
38.Sh NAME
39.Nm fmt
40.Nd simple text formatter
41.Sh SYNOPSIS
38.Dt FMT 1
39.Os
40.Sh NAME
41.Nm fmt
42.Nd simple text formatter
43.Sh SYNOPSIS
42.Nm
43.Op Fl c
44.Oo
45.Ar goal
46.Op Ar maximum
47.Oc
48.Op name ...
44.Nm fmt
45.Op Fl cmps
46.Op Fl d Ar chars
47.Op Fl l Ar num
48.Op Fl t Ar num
49.Op Ar goal Oo Ar maximum Oc | Fl Ns Ar width | Fl w Ar width
50.Op Ar
49.Sh DESCRIPTION
51.Sh DESCRIPTION
50.Nm Fmt
52.Nm
51is a simple text formatter which reads the concatenation of input
52files (or standard input if none are given) and produces on standard
53output a version of its input with lines as close to the
54.Ar goal
55length
53is a simple text formatter which reads the concatenation of input
54files (or standard input if none are given) and produces on standard
55output a version of its input with lines as close to the
56.Ar goal
57length
56as possible without exceeding the maximum. The
58as possible without exceeding the
59.Ar maximum .
60The
57.Ar goal
58length defaults
61.Ar goal
62length defaults
59to 65 and the maximum to 75. The spacing at the beginning of the
60input lines is preserved in the output, as are blank lines and
61interword spacing.
63to 65 and the
64.Ar maximum
65to 10 more than the
66.Ar goal
67length.
68Alternatively, a single
69.Ar width
70parameter can be specified either by prepending a hyphen to it or by using
71.Fl w .
72For example,
73.Dq Li fmt -w 72 ,
74.Dq Li fmt -72 ,
75and
76.Dq Li fmt 72 72
77all produce identical output.
78The spacing at the beginning of the input lines is preserved in the output,
79as are blank lines and interword spacing.
80Lines are joined or split only at white space; that is, words are never
81joined or hyphenated.
62.Pp
82.Pp
63.Fl c
64instructs
65.Nm
66to center the text.
83The options are as follows:
84.Bl -tag -width indent
85.It Fl c
86Center the text, line by line.
87In this case, most of the other
88options are ignored; no splitting or joining of lines is done.
89.It Fl m
90Try to format mail header lines contained in the input sensibly.
91.It Fl p
92Allow indented paragraphs.
93Without the
94.Fl p
95flag, any change in the amount of whitespace at the start of a line
96results in a new paragraph being begun.
97.It Fl s
98Collapse whitespace inside lines, so that multiple whitespace
99characters are turned into a single space.
100(Or, at the end of a
101sentence, a double space.)
102.It Fl d Ar chars
103Treat the
104.Ar chars
105(and no others) as sentence-ending characters.
106By default the
107sentence-ending characters are full stop
108.Pq Ql \&. ,
109question mark
110.Pq Ql \&?
111and exclamation mark
112.Pq Ql \&! .
113Remember that some characters may need to be
114escaped to protect them from your shell.
115.It Fl l Ar number
116Replace multiple spaces with tabs at the start of each output
117line, if possible.
118.Ar number
119spaces will be replaced with one tab.
120.It Fl t Ar number
121Assume that the input files' tabs assume
122.Ar number
123spaces per tab stop.
124The default is 8.
125.El
67.Pp
126.Pp
68.Nm Fmt
127.Nm
69is meant to format mail messages prior to sending, but may also be useful
70for other simple tasks.
71For instance,
72within visual mode of the
73.Xr ex 1
128is meant to format mail messages prior to sending, but may also be useful
129for other simple tasks.
130For instance,
131within visual mode of the
132.Xr ex 1
74editor (e.g.
133editor (e.g.,
75.Xr vi 1 )
76the command
77.Pp
78.Dl \&!}fmt
79.Pp
80will reformat a paragraph,
81evening the lines.
82.Sh SEE ALSO
83.Xr mail 1 ,
84.Xr nroff 1
85.Sh HISTORY
86The
87.Nm
88command appeared in
89.Bx 3 .
134.Xr vi 1 )
135the command
136.Pp
137.Dl \&!}fmt
138.Pp
139will reformat a paragraph,
140evening the lines.
141.Sh SEE ALSO
142.Xr mail 1 ,
143.Xr nroff 1
144.Sh HISTORY
145The
146.Nm
147command appeared in
148.Bx 3 .
90.\" .Sh AUTHOR
91.\" Kurt Shoens
92.\" .br
93.\" Liz Allen (added goal length concept)
149.Pp
150The version described herein is a complete rewrite and appeared in
151.Fx 4.4 .
152.Sh AUTHORS
153.An Kurt Shoens
154.An Liz Allen
155(added
156.Ar goal
157length concept)
158.An Gareth McCaughan
94.Sh BUGS
95The program was designed to be simple and fast \- for more complex
96operations, the standard text processors are likely to be more appropriate.
159.Sh BUGS
160The program was designed to be simple and fast \- for more complex
161operations, the standard text processors are likely to be more appropriate.
162.Pp
163When the first line of an indented paragraph is very long (more than
164about twice the goal length), the indentation in the output can be
165wrong.
166.Pp
167.Nm
168is not infallible in guessing what lines are mail headers and what
169lines are not.