Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > F


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


fmt — format text


fmt [-cs] [-w width] [file...]


The fmt command is a simple text formatter that fills and joins lines to produce output lines of (up to) the number of characters specified in the -w width option. The default width is 72. fmt concatenates the file arguments. If none are given, fmt formats text from the standard input.

Blank lines are preserved in the output, as is the spacing between words. fmt does not fill lines beginning with a period (.), for compatibility with nroff. Nor does it fill lines starting with From:.

Indentation is preserved in the output and input lines with differing indentation are not joined (unless -c is used).

fmt can also be used as an in-line text filter for vi; the vi command:


reformats the text between the cursor location and the end of the paragraph.


fmt recognizes the following options:


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. This is useful for tagged paragraphs.


Split lines only. Do not join short lines to form longer ones. This prevents sample lines of code, and other such ``formatted'' text, from being unduly combined.


Fill output lines to up to width columns.


The -w width option is acceptable for BSD compatibility, but it may go away in future releases.


nroff(1), vi(1).

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.