[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Guide to Printers and Printing

Formatting Files for Printing (pr Command)

The pr command performs simple formatting of the files you sent to be printed. You pipe the output of the pr command to the qprt command to format your text.

Some useful pr command flags are:

-d Double-spaces the output.
-h "String" Displays the specified string, enclosed in " " (quotes), instead of the file name as the page header. The flag and string should be separated by a space.
-l Lines Overrides the 66-line default and resets the page length to the number of lines specified by the Lines variable. If the Lines value is smaller than the sum of both the header and trailer depths (in lines), the header and trailer are suppressed (as if the -t flag were in effect).
-m Merges files. Standard output is formatted so the pr command writes one line from each file specified by a File variable, side by side into text columns of equal fixed widths, based on the number of column positions. This flag should not be used with the -Column flag.
-n [Width][Character] Provides line numbering based on the number of digits specified by the Width variable. The default is 5 digits. If the Character (any non-digit character) variable is specified, it is appended to the line number to separate it from what follows on the line. The default character separator is the ASCII TAB character.
-o Offset Indents each line by the number of character positions specified by the Offset variable. The total number of character positions per line is the sum of the width and offset. The default value of Offset is 0.
-sCharacter Separates columns by the single character specified by the Character variable instead of by the appropriate number of spaces. The default value for Character 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.
-w Width Sets the number of column positions per line to the value specified by the Width variable. The default value is 72 for equal-width multicolumn output. There is no limit otherwise. If the -w flag is not specified and the -s flag is specified, the default width is 512 column positions.
-Column Sets the number of columns to the value specified by the Column variable. The default value is 1. This option should not be used with the -m flag. The -e and -i flags are assumed for multicolumn output. A text column should never exceed the length of the page (see the -l flag). When this flag is used with the -t flag, use the minimum number of lines to write the output.
+Page Begins the display with the page number specified by the Page variable. The default value is 1.

For example, to print a file named prog.c with headings and page numbers on the printer, enter:

pr prog.c | qprt

This adds page headings to prog.c and sends it to the qprt command. The heading consists of the date the file was last modified, the file name, and the page number.

For example, to specify a title for a file named prog.c, enter:

pr -h "MAIN PROGRAM" prog.c | qprt

This prints prog.c with the title MAIN PROGRAM in place of the file name. The modification date and page number are still printed.

For example, to print a file named word.lst in multiple columns, enter:

pr -3 word.lst | qprt

This prints the word.lst file in three vertical columns.

For example, to print several files side by side on the paper:

pr -m -h "Members and Visitors" member.lst visitor.lst | qprt

This prints member.lst and visitor.lst side by side with the title Members and Visitors.

For example, to modify a file named prog.c for later use, enter:

pr -t -e prog.c > prog.notab.c

This replaces tab characters in prog.c with spaces and puts the result in prog.notab.c. Tab positions are at columns 9, 17, 25, 33, and so on. The -e flag tells the pr command to replace the tab characters; the -t flag suppresses the page headings.

For example, to print a file named myfile in two columns, in landscape, and in 7-point text, enter:

pr -l66 -w172 -2 myfile | qprt -z1 -p7

See the pr command in the AIX 5L Version 5.1 Commands Reference for the exact syntax.

[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]