print files (POSIX)


pr [+page] [-column] [-a] [-d] [-e[char][gap]]

   [-f] [-h header] [-i[char][gap]] [-l lines] [-m]

   [-n[char][width]] [-ooffset] [-r] -s[char] [-t] 

   [-wwidth] [-c | -v] [-b]



Begin printing at the page number of the formatted input that is specified by page.
Print output in columns that is column spaces wide and is in text column rank order (default number of columns is 1). When you specify this option, options -e and -i are assumed for multiple text-column output. If you specify the -t option, pr uses the minimum number of lines to display the output.

The -m option is not allowed when the -column option is used.

Print multiple-column output across the page. You should use this option only with the -column option.
(GNU extension) Balance columns on the last page.
(GNU extension) Print unprintable chars as control prefixes (^c)
Print double-spaced output; append an extra newline after every newline found in the input.
-e [char] [gap]
Expand input tabs to column positions gap+1, 2xgap+1, 3xgap+1, etc. If gap is zero or is omitted, pr assumes default tab settings at every eighth position. All tab characters in the input are expanded into the appropriate number of space characters. If you specify any non-digit character, char, the character is treated as the tab expansion character.
(GNU extension) Synonym for -F, below.
Use a form-feed character for new pages (default is to use a sequence of newline characters). Prior to displaying the first page of output, an alert character is written to standard output.
-h header
Use the string header for the header, instead of the filename.
-i [char] [gap]
In output, replace multiple space characters with tabs wherever two or more adjacent space characters reach column positions gap+1, 2xgap+1, 3xgap+1, etc. If gap is zero or is omitted, pr assumes default tab settings at every eighth position. If you specify char (any non-digit character), the character is used as the output tab character.
-l lines
("el") Set the page length to lines (default is 66 lines). If lines is smaller than the number of lines required for the header and trailer, pr suppresses both the header and the trailer, as if the -t option were in effect.
Merge files. Standard output is formatted so that pr writes one line from each specified file side by side into text columns of equal fixed widths, in terms of the number of column positions.
-n [char][width]
In output, provide line numbering that is width digits wide (default width for line numbering is 5 digits). The number occupies the first width+1 column positions of each text column or each line of -m output. If char (any non-digit character) is given, the character is appended to the line number to separate it from whatever follows (default for char is a tab character). The maximum width you may specify is 9.
Precede each line of the output by the number of space characters specified by offset. (default number of spaces is zero). The number of column positions per line is the sum of the width (from the -n option) and the offset.
Don't print diagnostic reports on failure to open files.
Separate text columns by the single character char (default for char is the tab character).
Print neither the identifying header nor the trailer normally supplied for each page. Quit printing after the last line of each file without spacing to the end of the page.
(GNU extension) Print unprintable chars as octal escapes (\nnn)
Set the width of the line to width column positions for multiple text-column output only (default is 71).
The pathname of a file to be printed. If you don't specify any files, or if file is the dash character (-), the standard input is used.

The options -l ("el"), -o, -s, and -w don't allow the option letter to be separated from its argument. The options -e, -i, and -n require that both arguments, if present, not be separated from the option letter.


The pr utility is a printing and pagination filter that prints files to the standard output.

By default, the listing is separated into pages, each with a header that includes the page number, date, time, and the file's pathname. The header is of the form:






The trailer is simply the 5 newline characters required to advance to the next top of form (unless -f is used, in which case a form-feed will be sent). Text columns are of equal width; there is at least one blank separation character between text columns. Lines that don't fit into a text column are truncated. If standard output is associated with a terminal, diagnostic messages are suppressed until pr has completed processing.

Exit status:

All files were written successfully.
An error occurred.

Environment variables:

Specifies the local time zone for use in writing header lines.

Asynchronous Events:

If pr receives an interrupt while printing to a terminal, it flushes all accumulated error messages to the screen before terminating.

See also: