The pr command flags – HP NonStop G-Series User Manual
Page 97

to take the output from the pr command and use it as input to the more command. For more
information on pipes, see
.
Sometimes you may prefer to display a file in a more sophisticated format. You can use a number
of flags in the pr command to specify additional formatting features.
explains several
of these flags.
Table 16 The pr Command Flags
Description
Flag
Begins formatting on page number page; otherwise, formatting begins on page 1.
For example, the pr +2 file1 command starts formatting file1 on page 2.
+page
Produces the specified number of columns (the default value is 1).
-column
Formats pages into two columns. Otherwise, pr formats pages with one column.
-2
Formats all specified files at the same time, side by side, one in each column. For
example, the pr -m file1 file2 command displays the contents of file1 in
the left column and that of file2 in the right column.
-m
Formats double-spaced output; otherwise, output is single-spaced. For example, the
pr -d file1
command displays file1 in double-spaced format.
-d
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 device is tty. Press Return to break the pause.
-f
Uses a form-feed character to advance to a new page; otherwise, pr issues a
sequence of line-feed characters. Does not pause before beginning the first page if
the standard output device is tty.
-F
Sets line width to num bytes; otherwise, line width is 72 bytes. For example, the
pr -w40 file1
command sets the line width of file1 to 40 bytes.
-wnum
Offsets (indents) each line by num byte positions. Otherwise, the offset is 0 (zero)
byte positions. For example, the pr -o5 file1 command indents each line of
file1
five spaces.
-onum
Sets page length to num lines; otherwise, page length is 66 lines. For example, the
pr -l 60 file1
command sets the page length of file1 to 60 lines.
-lnum
Uses string, rather than the filename, in the header (title) that is displayed at the
top of every page. If string includes blanks or special characters, it must be enclosed
-h string
in ' ' (single quotes). For example, the pr -h 'My Novel' file1 command
specifies “My Novel” as the title.
Prevents pr from formatting headings and the blank lines at the end of each page.
For example, the pr -t file1 command specifies that file1 be formatted without
headings and without blank lines at the end of each page.
-t
Separates columns with the character char rather than with blank spaces. You must
enclose the character in single quotes. char must be a single character. For example,
the pr -s'*' file1 command specifies that asterisks separate columns.
-schar
You can use more than one flag at a time with the pr command. The following example instructs
pr
to format file1 as follows:
•
In two columns (-2)
•
With double spacing (-d)
•
With the title “My Novel” rather than the name of the file
$ pr -2dh 'My Novel' file1
For detailed information about pr and its flags, refer to the pr(1) reference page either online
or in the Open System Services Shell and Utilities Reference Manual. The pr command can also
be used to format files for printing. See
, for more information.
Displaying Files
97