pr
PURPOSE
Writes a file to standard output.
SYNOPSIS
pr [ options ] [ files ]
DESCRIPTION
The pr command writes file to the standard output. If
you do not specify file or if file is a - (minus), pr
reads standard input. A heading that contains the page
number, date, time, and the name of the file separates
the output into pages.
Unless specified, columns are of equal width and sepa-
rated by at least one space. Lines that are too long for
the page width are cut off. If the standard output is a
work station, pr does not display any error messages
until it has ended.
FLAGS
-a Displays multi-column output across the
page.
-d Double-spaces the output.
-e[char][num] Expands tabs to character positions num+1,
2*num+1, 3*num+1, and so on. The default
value of num is 8. Tab characters in the
input expand to the appropriate number of
spaces to line up with the next tab
setting. If you specify char (any char-
acter other than a digit) that character
becomes the input tab character. The
default value of char is the ASCII TAB
character.
-f Uses a form-feed character to advance to a
new page. (Otherwise pr issues a sequence
of line-feed characters.) Pauses before
beginning the first page if the standard
output is a work station.
-h "string" Displays string as the page header instead
of the file name. The flag and string
should be separated by a blank.
-i[char][num] In the output, replaces white space wher-
ever possible by inserting tabs to char-
acter positions num+1, 2*num+1, 3*num+1,
and so on. The default value of num is 8.
If you specify char (any character other
than a digit), that character becomes the
output tab character. (The default value
of char is the ASCII TAB character).
-lnum Sets the length of a page to num lines
(the default is 66).
-m Combines and writes all files at the same
time, with each file in a separate column.
(This overrides the -num and -a flags).
-n[char][num] Provides num-digit line numbering (the
default value of num is 5). The number
occupies the first num+1 character posi-
tions of each column of normal output or
each line of -m output. If you specify
char (any character other than a digit),
that character is added to the line number
to separate it from whatever follows (the
default value of char is an ASCII TAB
character).
-onum Indents each line by num character posi-
tions (the default is 0). The number of
character positions per line is the sum of
the width and offset.
-p Pauses before beginning each page if the
output is directed to a work station. (pr
sounds the alarm at the work station and
waits for you to press the Enter key.)
-r Does not display diagnostic messages if
the system cannot open files.
-schar Separates columns by the single character
char instead of by the appropriate number
of spaces (the default for char is an
ASCII TAB character).
-t Does not display the five-line identifying
header and the five-line footer. Stops
after the last line of each file without
spacing to the end of the page.
-wnum Sets the width of a line to num character
positions (the default value is 72 for
equal-width multi-column output, no limit
otherwise).
-num Produce num-column output (the default is
1). The -e and -i flags are assumed for
multi-column output.
+num Begin the display with page num (the
default value is 1).
EXAMPLES
1. To print a file with headings and page numbers on the
printer:
pr prog.c | print
This adds page headings to "prog.c" and sends it to
the print command. The heading consists of the date
the file was last modified, the file name, and the
page number.
2. To specify a title:
pr -h "MAIN PROGRAM" prog.c | print
This prints "prog.c" with the title "MAIN PROGRAM" in
place of the file name. The modification date and
page number are still printed.
3. To print a file in multiple columns:
pr -3 word.lst | print
This prints the file "word.lst" in three vertical
columns.
4. To print several files side-by-side on the paper:
pr -m -h "Members and Visitors" member.lst visitor.lst | print
This prints "member.lst" and "visitor.lst" side by
side with the title "Members and Visitors".
5. To modify a file for later use:
pr -t -e prog.c > prog.notab.c
This replaces tab characters in "prog.c" with blanks
and puts the result in "prog.notab.c". Tab positions
are at columns 9, 17, 25, 33, . . . . The "-e" tells
pr to replace the tab characters; the "-t" suppresses
the page headings.
FILES
/dev/tty* To suspend messages.
RELATED INFORMATION
The following command: "cat."