Go to the first, previous, next, last section, table of contents.


pr: Paginate or columnate files for printing

pr writes each file (`-' means standard input), or standard input if none are given, to standard output, paginating and optionally outputting in multicolumn format; optionally merges all files, printing all in parallel, one per column. Synopsis:

pr [option]... [file]...

By default, a 5-line header is printed: two blank lines; a line with the date, the file name, and the page count; and two more blank lines. A footer of five blank lines is also printed. With the `-f' option, a 3-line header is printed: the leading two blank lines are omitted; no footer used. The default page_length in both cases is 66 lines. The text line of the header takes up the full page_width in the form `yy-mm-dd HH:MM string Page nnnn'. String is a centered string.

Form feeds in the input cause page breaks in the output. Multiple form feeds produce empty pages.

Columns have equal width, separated by an optional string (default space). Lines will always be truncated to line width (default 72), unless you use the `-j' option. For single column output no line truncation occurs by default. Use `-w' option to truncate lines in that case.

The program accepts the following options. Also see section Common options.

`+first_page[:last_page]'
Begin printing with page first_page and stop with last_page. Missing `:LAST_PAGE' implies end of file. While estimating the number of skipped pages each form feed in the input file results in a new page. Page counting with and without `+first_page' is identical. By default, it starts with the first page of input file (not first page printed). Page numbering may be altered by `-N' option.
`-column'
With each single file, produce column-column output and print columns down. The column width is automatically estimated from page_width. This option might well cause some columns to be truncated. The number of lines in the columns on each page will be balanced. `-column' may not be used with `-m' option.
`-a'
With each single file, print columns across rather than down. column must be greater than one.
`-c'
Print control characters using hat notation (e.g., `^G'); print other unprintable characters in octal backslash notation. By default, unprintable characters are not changed.
`-d'
Double space the output.
`-e[in-tabchar[in-tabwidth]]'
Expand tabs to spaces on input. Optional argument in-tabchar is the input tab character (default is TAB). Second optional argument in-tabwidth is the input tab character's width (default is 8).
`-f'
`-F'
Use a form feed instead of newlines to separate output pages. Default page length of 66 lines is not altered. But the number of lines of text per page changes from 56 to 63 lines.
`-h HEADER'
Replace the file name in the header with the centered string header. Left-hand-side truncation (marked by a `*') may occur if the total header line `yy-mm-dd HH:MM HEADER Page nnnn' becomes larger than page_width. `-h ""' prints a blank line header. Don't use `-h""'. A space between the -h option and the argument is always peremptory.
`-i[out-tabchar[out-tabwidth]]'
Replace spaces with tabs on output. Optional argument out-tabchar is the output tab character (default is TAB). Second optional argument out-tabwidth is the output tab character's width (default is 8).
`-j'
Merge lines of full length. Used together with the column options `-column', `-a -column' or `-m'. Turns off `-w' line truncation; no column alignment used; may be used with `-s[separator]'.
`-l page_length'
Set the page length to page_length (default 66) lines. If page_length is less than or equal 10 (and <= 3 with `-f'), the headers and footers are omitted, and all form feeds set in input files are eliminated, as if the `-T' option had been given.
`-m'
Merge and print all files in parallel, one in each column. If a line is too long to fit in a column, it is truncated (but see `-j'). `-s[separator]' may be used. Empty pages in some files (form feeds set) produce empty columns, still marked by separator. Completely empty common pages show no separators or line numbers. The default header becomes `yy-mm-dd HH:MM <blanks> Page nnnn'; may be used with `-h header' to fill up the middle part.
`-n[number-separator[digits]]'
Precede each column with a line number; with parallel files (`-m'), precede only each line with a line number. Optional argument number-separator is the character to print after each number (default is TAB). Optional argument digits is the number of digits per line number (default is 5). Default line counting starts with first line of the input file (not with the first line printed, see `-N').
`-N line_number'
Start line counting with no. line_number at first line of first page printed.
`-o n'
Indent each line with n (default is zero) spaces wide, i.e., set the left margin. The total page width is n plus the width set with the `-w' option.
`-r'
Do not print a warning message when an argument file cannot be opened. (The exit status will still be nonzero, however.)
`-s[separator]'
Separate columns by a string separator. Don't use `-s separator', no space between flag and argument. If this option is omitted altogether, the default is a space, same as `-s" "'. With `-s' only, no separator is used, same as `-s""'. `-s' does not affect line truncation or column alignment.
`-t'
Do not print the usual header [and footer] on each page, and do not fill out the bottoms of pages (with blank lines or a form feed). No page structure is produced, but retain form feeds set in the input files. The predefined page layout is not changed. `-t' or `-T' may be useful together with other options; e.g.: `-t -e4', expand TAB in the input file to 4 spaces but do not do any other changes. Use of `-t' overrides `-h'.
`-T'
Do not print header [and footer]. In addition eliminate all form feeds set in the input files.
`-v'
Print unprintable characters in octal backslash notation.
`-w page_width'
Set the page width to page_width (default 72) characters. With/without `-w', header lines are always truncated to page_width characters. With `-w', text lines are truncated, unless `-j' is used. Without `-w' together with one of the column options `-column', `-a -column' or `-m', default truncation of text lines to 72 characters is used. Without `-w' and without any of the column options, no line truncation is used. That's equivalent to `-w 72 -j'.


Go to the first, previous, next, last section, table of contents.