PR(1V)

NAME
pr - prepare file(s) for printing, perhaps in multiple columns

SYNOPSIS
pr [ -|+ n ] [ -fmt ] [ -h string ] [ -ln ] [ -sc ]
[ -wn ] [ filename ] ...

SYSTEM V SYNOPSIS
/usr/5bin/pr [ -|+ n ] [ -adfmprt ] [ -eck ]
[ -h string ] [ -ick ] [ -ln ] [ -nck ]
[ -on ] [ -sc ] [ -wn ] [ filename ] ...

AVAILABILITY
The System V version of this command is available with the System V software installation option. Refer to for information on how to install optional software.

DESCRIPTION
pr prepares one or more filenames for printing. By default, the output is separated into pages headed by a date, the name of the file, and the page number. pr prints its standard input if there are no filename arguments. FORMFEED characters in the input files cause page breaks in the output, as expected.

By default, columns are of equal width, separated by at least one SPACE; lines that do not fit are truncated. If the -s option is used, lines are not truncated and columns are separated by the separation character.

Inter-terminal messages using write(1) are forbidden during a pr.

OPTIONS

Options apply to all following filenames but may be reset between filenames:

-f  Use FORMFEED characters instead of NEWLINE characters to separate pages. A FORMFEED is assumed to use up two blank lines at the top of a page. Thus this option does not affect the effective page length.

-m  Print all filenames simultaneously, each in one column, for example:
        Print	Print	The
        the	the	third
        lines	lines	file's
        of 	of	lines
        file	file	go
        one.	two.	here.

-t  Do not print the 5-line header or the 5-line trailer normally supplied for each page. Pages are not separated when this option is used, even if the -f option was used. The -t option is intended for applications where the results should be directed to a file for further processing.

-h string
    Use string, instead of the file name, in the page header.

-ln Take the length of the page to be n lines instead of the default 66.

-sc Separate columns by the single character c instead of by the appropriate amount of white space. A missing c is taken to be a TAB.

-wn For multicolumn output, take the width of the page to be n characters instead of the default 72.

-n  Produce n-column output. For example:
        Print	of	in
        the	one	three
        lines	file	columns.

    Columns are not balanced; if, for example, there are as many lines in the file as there are lines on the page, only one column will be printed. Even if the -t option (see below) is specified, blank lines will be printed at the end of the output to pad it to a full page.

+n  Begin printing with page n.

SYSTEM V OPTIONS
When the -n option is specified for multicolumn output, columns are balanced. For example, if there are as many lines in the file as there are lines to be printed, and two columns are to be printed, each column will contain half the lines of the file. If the -t option is specified, no blank lines will be printed to pad the last page.

The options -e and -i are assumed for multicolumn output. The -m option overrides the -k and -a options.

The -f option does not assume that FORMFEED uses up two blank lines; blank lines will be printed after the FORMFEED if necessary. If the standard output is a terminal, -f will cause pr to wait for a RETURN before printing the first page.

    -a  When combined with the -n option, print multicolumn output across the page. For example:
            Print	the	lines
            of	one	file
            in	three	columns.

    -d  Double-space the output.

    -p  Pause before beginning each page if the output is directed to a terminal (pr will ring the bell at the terminal and wait for a RETURN).

    -r  Do Not print diagnostic reports if a file cannot be opened, or if it is empty.

    -eck
        Expand input TAB characters to character positions k+1, 2*k+1, 3*k+1, etc. If k is 0 or is omitted, default TAB settings at every eighth position are assumed. TAB characters in the input are expanded into the appropriate number of SPACE characters. If c (any non-digit character) is given, it is treated as the input TAB character (default for c is the TAB character).

    -ick
        In output, replace white space wherever possible by inserting TAB characters to character positions k+1, 2*k+1, 3*k+1, etc. If k is 0 or is omitted, default TAB settings at every eighth position are assumed. If c (any non-digit character) is given, it is treated as the output TAB (default for c is the TAB character).

    -nck
        Provide k-digit line numbering (default for k is 5). The number occupies the first k+1 character positions of each column of normal output or each line of -m output. If c (any non-digit character) is given, it is appended to the line number to separate it from whatever follows (default for c is a TAB).

    -ok Offset each line by k character positions. The number of character positions per line is the sum of the width and offset.

EXAMPLES

Print a file called dreadnought on the printer — this is the simplest use of pr:

    example% pr dreadnought | lpr
    example%

Produce three laminations of a file called ridings side by side in the output, with no headers or trailers, the results to appear in the file called Yorkshire:

    example% pr -m -t ridings ridings ridings > Yorkshire
    example%

FILES
/dev/tty*
    to suspend messages.

SEE ALSO
cat(1V), lpr(1), write(1)

DIAGNOSTICS

can't print 0 cols, using 1 instead.
    -0 was specified as a -n option.

pr: bad key key
    An illegal option was given.

pr: No room for columns.
    The number of columns requested will not fit on the page.

pr: Too many args
    More than 10 files were specified with the -m option.

filename : error
    filename could not be opened. This diagnostic is not printed if pr is printing on a terminal.

SYSTEM V DIAGNOSTICS

pr: bad option
    An illegal option was given.

pr: width too small
    The number of columns requested will not fit on the page.

pr: too many files
    More than 10 files were specified with the -m option.

pr: page-buffer overflow
    The formatting required is more complicated than pr can handle.

pr: out of space
    pr could not allocate a buffer it required.

pr: filename-- empty file
    filename was empty. This diagnostic is printed after all the files are printed if pr is printing on a terminal.

pr: can't open filename
    filename could not be opened. This diagnostic is printed after all the files are printed if pr is printing on a terminal.

BUGS

The options described above interact with each other in strange and as yet to be defined ways.