Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > P


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


pr — print files


pr [options] [files]


The pr command prints the named files on the standard output. If file is -, or if no files are specified, the standard input is assumed. By default, the listing is separated into pages, each headed by the page number, a date and time, and the name of the file.

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.

If the standard output is associated with a terminal, error messages are withheld until pr has completed printing.


The following options can be used singly or combined in any order:


Begin printing with page k (default is 1).


Produce k-column output (default is 1). This option should not be used with -m. The options -e and -i are assumed for multi-column output.

-c k

Produce k-column output, same as -k.


Print multi-column output across the page. This option is appropriate only with the -k option.


Merge and print all files simultaneously, one per column (overrides the -k and -a options).


Double space the output.


Expand input tabs 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 spaces. If c (any nondigit character) is given, it is treated as the input tab character (default for c is the tab character).


In output, replace white space wherever possible by inserting tabs 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 nondigit character) is given, it is treated as the output tab character (default for c is the tab character).


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 nondigit character) is given, it is appended to the line number to separate it from whatever follows (default for c is a tab).


Set the width of a line to k character positions (default is 72 for equal-width, multi-column output; no limit otherwise). Width specifications are only effective for multi-columnar output.


Offset each line by k character positions (default is 0). The number of character positions per line is the sum of the width and offset.


Set the length of a page to k lines (default is 66). If k is less than what is needed for the page header and trailer, the -t option is in effect; that is, header and trailer lines are suppressed in order to make room for text.


Use the next argument as the header to be printed instead of the file name.


Pause before beginning each page if the output is directed to a terminal (pr rings the bell at the terminal and waits for a Return).


Use 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.


Same as -F. Provided for backwards compatibility.


Print no diagnostic reports on failure to open files.


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.


Separate columns by the single character c instead of by the appropriate number of spaces (default for c is a tab).


Environment Variables

LC_CTYPE determines the interpretation of text and the arguments associated with the -e, -i, -n, and -s options as single-byte and/or multi-byte characters.

LC_TIME determines the format and contents of date and time strings.

LC_MESSAGES determines the language in which messages are displayed.

If LC_CTYPE, LC_TIME, or LC_MESSAGES is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable. If LANG is not specified or is set to the empty string, a default of C (see lang(5)) is used instead of LANG.

If any internationalization variable contains an invalid setting, pr behaves as if all internationalization variables are set to C. See environ(5).

International Code Set Support

Single-byte and multi-byte character code sets are supported.


The pr returns the following values upon completion:


Successful completion.


One or more of the input files do not exist or cannot be opened.


Print file1 and file2 as a double spaced, three column listing headed by ``file list'':

pr -3dh "file list" file1 file2

Write file1 on file2, expanding tabs to columns 10, 19, 28, 37, ... :

pr -e9 -t <file1 >file2

Print file1 in default format with nonblank lines numbered down the left side:

nl file1 | pr




cat(1), lp(1), nl(1), ul(1).



Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.