[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 2

fill or ffill Command

Purpose

Fills arbitrarily broken lines of text.

Syntax

fill [-d] [-x] [Request ...]

ffill [-lNumber]

Description

The fill command is a text-processing filter that provides the paragraph fill and indentation effects of the nroff command without requiring special command lines in the original text file. The ffill command is a fast version of the fill command that does not use the nroff formatter.

You can use the fill and ffill commands as filters with the Do command (the Alt-X key sequence), which runs the filter, or as filter commands from the system prompt. For information about keyboard layouts, press the F1 key (the Help key) within the INed editor. The fill command reads text from standard input, performs text processing by inserting command lines in the text file, and then processes the result through the nroff formatter. You also use the fill command to insert nroff subcommands into a text file to produce an nroff source file, which you can then revise for other applications. See "Running AIX and Filter Commands from the INed Editor" in the AIX Version 4.3 INed Editor User's Guide for more information on running filters from the editor.

Attention: If you do not have the nroff formatter installed, using the fill command may cause loss of data. The fill command should not be run from the command line.

If you enter the fill command with a file name from the system prompt, it reads the text from that file, fills each paragraph, and writes the result to standard output.

The fill command treats a blank line as the end of the current paragraph. This command indents the first and second lines of each paragraph as they are indented in the input file. All subsequent lines in the paragraph are indented to match the second line. All tabs are removed. An extra space is inserted after each word that ends with a . (period), ? (question mark), or an ! (exclamation point).

In the text processing mode, the fill command turns off hyphenation, sets all escape characters to ~ (tilde) to prevent the text from being altered unexpectedly, and disables pagination.

The fill command formats indented paragraphs and reads embedded nroff requests. This command always indents the first and second lines of a paragraph exactly as they are indented in the source text, and aligns all subsequent lines with the second line. The fill command treats multiple spaces and tabs within a line as single spaces, except for spaces preceded by periods and colons. If a . (period) or : (colon) is followed by more than one space in the original text, the fill command follows the . (period) or : (colon) by two spaces in the result. The fill command correctly formats block paragraphs with hanging labels on the first line. Therefore, you can edit previously filled paragraphs and then refill the text. In situations such as tables, the compression of multiple blanks is undesirable and can be suppressed with the -x flag.

If you supply the Request parameter, the fill command treats it as an nroff command line and passes it directly to the nroff command if the specified request begins with a . (period). If the request does not begin with a . (period), the fill command passes it to the nroff command as a value. You can give the fill command one or more Request parameters (nroff requests).

All lines beginning with a . (period) are considered to be nroff requests. These lines are preserved as separate lines, even when they are in the middle of a paragraph. This allows you to use the fill command to improve the appearance of a draft document without destroying embedded nroff requests that may be inserted for reformatting a final or a typeset version.

With the INED editor, you can format a paragraph by beginning the first two lines with the proper indentations and then using the fill command to fill the entire paragraph.

You cannot change the escape characters with a parameter to the fill command.

If the fill command is unable to create its temporary file, the fill command exits with the value of -2.

Notes:
  1. The ffill command sets the left margin incorrectly if the first line of any paragraph is more than twice as long as the specified right margin.
  2. The ffill command produces incorrect output for input lines longer than 512 characters.

Flags

-d Does not process through the nroff formatter. In this mode, the fill command takes text from standard input, inserts nroff request lines that preserve indentation and paragraphing, and writes the result to standard output.
-lNumber Sets the right margin at the column specified by the Number variable. The default value for Number is 65. The -lNumber flag is used with the ffill command only.
-x Suppresses compression of multiple blanks within input text lines. Initial blanks are always replaced by paragraph-indenting commands. The -x flag is useful for processing text that is bracketed by the nroff requests, .nf or .na, because it prevents the loss of spacing between columns.

You can use the -d flag and the -x flag to insert nroff commands in a text file without passing the text through the nroff formatter. This is useful as a first step in converting a conventionally formatted text file to an nroff source file or as a building block in a program or AIX command file that performs specialized processing of text files.

Examples

  1. To fill with hyphenation, enter:
    fill".hy1"
  2. To fill lines between columns 10 and 70, enter:
    fill".in10"".l170"

Files

/var/tmp/IjustNumber Contains the temporary file. The Number part of the file name represents the process number in decimal.

Related Information

The e command, just command, nroff command.

Editors Overview in AIX Version 4.3 INed Editor User's Guide introduces general concepts about editors and describes the main AIX editors.

Running AIX and Filter Commands from the INed Editor AIX Version 4.3 INed Editor User's Guide.


[ Previous | Next | Contents | Glossary | Home | Search ]