fmt Command

Purpose

Formats mail messages prior to sending.

Syntax

/usr/bin/fmt [ -Width ] [ File ... ]

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.

Note: Do not use the fmt command if the message contains embedded messages or preformatted information from other files. This command formats the heading information in embedded messages and may change the format of preformatted information.

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

  1. To format a message you have created with the mail editor, enter:
    ~| fmt
    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.
  2. To format a file and display the output on your screen, enter:
    fmt file1
    In this example, the file file1 is formatted and displayed on your screen.

Files

Item Description
/usr/bin/fmt Contains the fmt command.