pr(1) pr(1)
NAME
pr - print files
SYNOPSIS
pr [-columns [-w width] [-a]] [-e[c][k]] [-i[c][k]] [-dFfprt]
[+page] [-n[c][k]] [-o offset] [-l length] [-s[separator]]
[-h header] [file . . .]
pr [-m [-w width]] [-e[c][k]] [-i[c][k]] [-dFfprt]
[+page] [-n[c][k]] [-o offset] [-l length] [-s[separator]]
[-h header] [file . . .]
DESCRIPTION
The pr command formats and prints the contents of a file. If
file is -, or if no files are specified, pr assumes standard
input. The named files are printed on standard output. pr
processes supplementary code set characters in files, and
recognizes supplementary code set characters in the character
or string arguments given to the -e, -h, -i, -n, and -s
options (see below) according to the locale specified in the
LC_CTYPE environment variable [see LANG on environ(5)].
Multibyte characters will not be split when lines are
truncated or folded.
By default, the listing is separated into pages, each headed
by the page number, the date and time that the file was last
modified, and the name of the file. Page length is 66 lines
which includes 10 lines of header and trailer output. The
header is composed of 2 blank lines, 1 line of text (can be
altered with -h), and 2 blank lines; the trailer is 5 blank
lines. For single column output, line width may not be set
and is unlimited. For multicolumn output, line width may be
set and the default is 72 columns (unless -s is specified, in
which case it is 512 columns). Diagnostic reports (failed
options) are reported at the end of standard output associated
with a terminal, rather than interspersed in the output.
Pages are separated by series of line feeds rather than form
feed characters.
By default, columns are of equal width, separated by at least
one space; lines which do not fit are truncated. If the -s
option is used, columns are separated by the separator
character.
Either -columns or -m should be used to produce multi-column
output. -a should only be used with -columns and not -m.
Copyright 1994 Novell, Inc. Page 1
pr(1) pr(1)
OPTIONS
+page Begin printing with page numbered page (default is
1).
-columns Print columns columns of output (default is 1).
Output appears as if -e and -i are on for multi-
column output. May not use with -m.
-a Print multi-column output across the page one line
per column. columns must be greater than one. If
a line is too long to fit in a column, it is
truncated.
-d Double-space the output. Blank lines that result
from double-spacing are dropped when they occur at
the top of a page.
-e[c][k] Expand input tabs to character positions k+1,
2*k+1, 3*k+1, and so on. If k is 0 or is omitted,
default tab settings at every eighth column
position are assumed. Tab characters in the input
are expanded into the appropriate number of
spaces. If c is given, it is treated as the input
tab character (default for c is the tab
character). c must be a non-digit character.
-f Use a single form-feed character for new pages
(default is to use a sequence of line feeds).
Pause before beginning the first page if the
standard output is associated with a terminal.
(See NOTE below.)
-F Fold the lines of the input file. When used in
multi-column mode, (with the -a or -m options)
lines will be folded to fit the current column's
width. When used for single-column output, (for
example, when making a file printable on regular-
sized paper) -F must be used with the -wwidth
option (for example, -F -w72). (See NOTE below.)
-h header Use header as the text line of the header to be
printed instead of the file name. -h is ignored
when -t is specified or -l length is specified and
the value of length is 10 or less.
Copyright 1994 Novell, Inc. Page 2
pr(1) pr(1)
-i[c][k] In output, replace white space wherever possible
by inserting tabs to character positions k+1,
2*k+1, 3*k+1, and so on. If k is 0 or is omitted,
default tab settings at every eighth column
position are assumed. If c is given, it is
treated as the output tab character (default for c
is the tab character). c must be a non-digit
character.
-l length Set the length of a page to length lines (default
is 66). A length of 0 specifies the default
length. By default, output contains 5 lines of
header and 5 lines of trailer leaving 56 lines for
user-supplied text. When -l length is used and
length exceeds 10, then length-10 lines are left
per page for user supplied text. When length is
10 or less, header and trailer output is omitted
to make room for user supplied text; see the -t
option.
-m Merge and print all files simultaneously, one per
column. The maximum number of files that may be
specified is nine. If a line is too long to fit
in a column, it is truncated. May not use with
-column.
-n[c][k] Provide k-digit line numbering (default for k is
5). The number occupies the first k+1 character
positions of each column of single column output
or each line of -m output. If c is given, it is
appended to the line number to separate it from
whatever follows (default for c is a tab). c must
be a non-digit character.
-o offset Offset each line by offset character positions
(default is 0). The number of character positions
per line is the sum of the width and offset.
-p Pause before beginning each page if the output
device is a terminal. pr rings the terminal bell
and waits for a carriage return.
-r Print no diagnostic reports on files that cannot
be opened.
Copyright 1994 Novell, Inc. Page 3
pr(1) pr(1)
-s[separator]
Separate columns by the single character separator
instead of by the appropriate number of spaces
(default for separator is a tab).
-t Print neither the five-line identifying header nor
the five-line trailer normally supplied for each
page. Quit printing after the last line of each
file without spacing to the end of the page. Use
of -t overrides the -h option.
-w width Set the width of a line to width character
positions (default is 72 if -s is not specified,
512 if -s is specified). This is effective only
for multi-column output (-column and -m) and for
single-column output when the -F option is used.
EXAMPLES
Print file1 and file2 as a double-spaced, three-column listing
headed by ``file list'':
pr -3dh "file list" file1 file2
Copy file1 to file2, expanding tabs to columns 10, 19, 28, 37,
. . . :
pr -e9 -t < file1 > file2
Print file1 and file2 simultaneously in a two-column listing
with no header or trailer where both columns have line
numbers:
pr -t -n file1 | pr -t -m -n file2 -
FILES
/dev/tty*
If standard output is directed to one of the special
files /dev/tty*, then other output directed to this
terminal is delayed until standard output is completed.
This prevents error messages from being interspersed
throughout the output.
/usr/lib/locale/locale/LC_MESSAGES/uxcore
language-specific message file [See LANG on environ(5).]
Copyright 1994 Novell, Inc. Page 4
pr(1) pr(1)
NOTES
The pr command automatically converts ^Ls (form feeds) into
multiple newlines. It also will interpret control characters
that printf [see fprintf(3S)] interprets.
POSIX 1003.2 specifies that -f and -F options be swapped. In
order to get POSIX.2 behavior, the POSIX2 environment variable
should be set.
The following environment variables affect the execution of
pr: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, LC_TIME, TZ [see
environ(5)].
REFERENCES
cat(1), fold(1), fprintf(3S), more(1), pg(1)
NOTICES
Use the posix2 environmental variable to get POSIX.2 behavior
that is inconsistent with existing System V behavior. posix2
swapped the -f and -F options.
Copyright 1994 Novell, Inc. Page 5