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. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 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$ 34.\" 35.\" Modified by Gareth McCaughan to describe the new version of `fmt' 36.\" rather than the old one. 37.Dd June 25, 2000 38.Dt FMT 1 39.Os 40.Sh NAME 41.Nm fmt 42.Nd simple text formatter 43.Sh SYNOPSIS 44.Nm fmt 45.Op Fl cmnps 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 51.Sh DESCRIPTION 52.Nm 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 58as possible without exceeding the 59.Ar maximum . 60The 61.Ar goal 62length defaults 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. 82.Pp 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 n 92Format lines beginning with a 93.Ql \&. 94(dot) character. 95Normally, 96.Nm 97does not fill these lines, for compatibility with 98.Xr nroff 1 . 99.It Fl p 100Allow indented paragraphs. 101Without the 102.Fl p 103flag, any change in the amount of whitespace at the start of a line 104results in a new paragraph being begun. 105.It Fl s 106Collapse whitespace inside lines, so that multiple whitespace 107characters are turned into a single space. 108(Or, at the end of a 109sentence, a double space.) 110.It Fl d Ar chars 111Treat the 112.Ar chars 113(and no others) as sentence-ending characters. 114By default the 115sentence-ending characters are full stop 116.Pq Ql \&. , 117question mark 118.Pq Ql \&? 119and exclamation mark 120.Pq Ql \&! . 121Remember that some characters may need to be 122escaped to protect them from your shell. 123.It Fl l Ar number 124Replace multiple spaces with tabs at the start of each output 125line, if possible. 126Each 127.Ar number 128spaces will be replaced with one tab. 129The default is 8. 130If 131.Ar number 132is 0, spaces are preserved. 133.It Fl t Ar number 134Assume that the input files' tabs assume 135.Ar number 136spaces per tab stop. 137The default is 8. 138.El 139.Pp 140.Nm 141is meant to format mail messages prior to sending, but may also be useful 142for other simple tasks. 143For instance, 144within visual mode of the 145.Xr ex 1 146editor (e.g., 147.Xr vi 1 ) 148the command 149.Pp 150.Dl \&!}fmt 151.Pp 152will reformat a paragraph, 153evening the lines. 154.Sh SEE ALSO 155.Xr mail 1 , 156.Xr nroff 1 157.Sh HISTORY 158The 159.Nm 160command appeared in 161.Bx 3 . 162.Pp 163The version described herein is a complete rewrite and appeared in 164.Fx 4.4 . 165.Sh AUTHORS 166.An Kurt Shoens 167.An Liz Allen 168(added 169.Ar goal 170length concept) 171.An Gareth McCaughan 172.Sh BUGS 173The program was designed to be simple and fast \- for more complex 174operations, the standard text processors are likely to be more appropriate. 175.Pp 176When the first line of an indented paragraph is very long (more than 177about twice the goal length), the indentation in the output can be 178wrong. 179.Pp 180.Nm 181is not infallible in guessing what lines are mail headers and what 182lines are not. 183