fmt Command
Purpose
Formats mail messages prior to sending.
Syntax
Description
The fmt command starts a text formatter that reads the concatenation of input Files (or standard input if no Files are specified), then produces on standard output a version of the input with the line lengths set to the value of -Width. If no value is specified with the -Width flag, the default value of 72 characters is used. The spacing at the beginning of the input lines is preserved in the output, as are blank lines and spacing between words.
The fmt command is generally used to format mail messages to improve their appearance before they are sent. However, the fmt command may also be useful for simple formatting tasks. For example, within visual mode of a text editing program such as the vi editor, the command !}fmt formats a paragraph so that all lines are set to the value specified with the -Width flag. If no value is specified with the -Width flag, the default value of 72 characters is used. Standard text editing programs are more appropriate than fmt for complex formatting operations.
Flags
Item | Description |
---|---|
File | Specifies the name of the file to be formatted. |
-Width | Specifies the line length. The default value for Width is 72 characters. |
Examples
- To format a message you
have created with the mail editor, enter:
The ~| is entered at the left margin of the message. After you issue the ~| fmt command, the message is formatted. The word (continue) is displayed to indicate that you can enter more information or send the message.~| fmt
- To format a file and
display the output on your screen, enter:
In this example, the file file1 is formatted and displayed on your screen.fmt file1
Files
Item | Description |
---|---|
/usr/bin/fmt | Contains the fmt command. |