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]
[file...]
The options for pr do not follow the standard utility
syntax rules. 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.
- +page
- Begin printing at the page number of the formatted input that is
specified by page.
- -column
- 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.
- -a
- Print multiple-column output across the page. You should use this option
only with the -column option.
- -b
- (GNU extension) Balance columns on the last page.
- -c
- (GNU extension) Print unprintable chars as control prefixes (^c)
- -d
- Print double-spaced output; append an extra newline character
after every newline found in the input.
- -e [char] [gap]
- Expand input tabs to column positions
gap+1, 2*gap+1,
3*gap+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, that character is treated as the
tab expansion character.
- -f
- (GNU extension) Synonym for -F, below.
- -F
- 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 (bell) 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, 2*gap+1,
3*gap+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), that 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.
- -m
- 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, that
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.
- -ooffset
- 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.
- -r
- Don't print diagnostic reports on failure to open files.
- -s[char]
- Separate text columns by the single character char
(default for char is the
tab character).
- -t
- 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.
- -v
- (GNU extension) Print unprintable chars as octal escapes (\nnn)
- -wwidth
- Set the width of the line to width column positions
for multiple text-column output only (default is 71).
- file
- 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 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:
\n
\n
MMM DD HH:MM YYYY Page N\n
\n
\n
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.
- TZ
- Specifies the local time zone for use in writing header lines.
If pr receives an interrupt while printing to a terminal,
it flushes all accumulated error messages to the screen before terminating.
- 0
- All files were written successfully.
- >0
- An error occurred.
GNU
Old (QNX 4.22 and earlier) versions of pr would fold long
lines. Versions of pr shipped with QNX 4.23 and
later do not. Use the fold utility to fold lines before
submitting the file to pr.
fold,
lp