Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pr(1) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cat(1)

expand(1)

fmt(1)

fold(1)

lp(1)

more(1)

page(1)

pg(1)

ascii(5)

pr(1)                                                                 pr(1)

NAME
     pr - prepare files for printing

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

DESCRIPTION
     The pr command formats and writes the contents of files on the stan-
     dard output.

     Output is either in single columns (default) or in multiple columns.
     Multi-column output can be produced by using either the - option or
     the -m option.

OPTIONS
     No option specified:
          The files are divided into pages which are separated by a
          sequence of line feed characters. The page length is 66 lines,
          which includes 10 lines of header and trailer output.

          Headers are made up of two blank lines, one line of text contain-
          ing the page number, date and time that the file was last modi-
          fied, and the file name, and two more blank lines. Trailers con-
          sist of five blank lines.

          Files are output in single columns. Lines that are too long are
          truncated.

          If the standard output is associated with a terminal, error mes-
          sages are not reported until all the specified files have been
          output.
























Page 1                       Reliant UNIX 5.44                Printed 11/98

pr(1)                                                                 pr(1)

     The following overview indicates the various options you can use to
     modify the output format:
     _______________________________________________________
    | Function                                   |  Option |
    |____________________________________________|_________|
    | Set first page to be displayed             |  +      |
    |____________________________________________|_________|
    | Split text into columns                    |  -      |
    |____________________________________________|_________|
    | Define how columns are to be filled        |  -a     |
    |____________________________________________|_________|
    | Define page width for multi-column output  |  -w     |
    |____________________________________________|_________|
    | Fold longer input lines                    |  -W     |
    |____________________________________________|_________|
    | Separate text columns                      |  -s     |
    |____________________________________________|_________|
    | Output files simultaneously in columns     |  -m     |
    |____________________________________________|_________|
    | Double-space the output                    |  -d     |
    |____________________________________________|_________|
    | Convert tabs to spaces                     |  -e     |
    |____________________________________________|_________|
    | Convert spaces to tabs                     |  -i     |
    |____________________________________________|_________|
    | Number lines                               |  -n     |
    |____________________________________________|_________|
    | Indent text                                |  -o     |
    |____________________________________________|_________|
    | Change page length                         |  -l     |
    |____________________________________________|_________|
    | Change file name in header                 |  -h     |
    |____________________________________________|_________|
    | Display file one page at a time            |  -p     |
    |____________________________________________|_________|
    | Use form-feed characters to separate pages |  -f     |
    |____________________________________________|_________|
    | Use form-feed characters to separate pages |  -F     |
    |____________________________________________|_________|
    | Suppress error messages                    |  -r     |
    |____________________________________________|_________|
    | Suppress output of header and trailer      |  -t     |
    |____________________________________________|_________|











Page 2                       Reliant UNIX 5.44                Printed 11/98

pr(1)                                                                 pr(1)

   Description of options in alphabetical order

     +pagenumber
          Starts output at the specified pagenumber.

          + not specified: Output begins at the first page.

     -columns
          Outputs the file in columns columns. Output appears as if -e and
          -i have been set with their default values.

          This option cannot be combined with -m.

          The columns of a page are filled with input lines from top to
          bottom.

          This setting can be changed with -a.

          The default page width for multi-column output is 72. This set-
          ting can be changed with -w.

          pr determines the width of each column by dividing the page width
          by the number of columns. If a line is too long, it is truncated
          to the right. Truncation can be suppressed with -s.

          - not specified: Single-column output.

          Warning:  Form feeds at the beginning of a line of text (^L = Hex
                    Code 0C) are ignored in multi-column output.

     -a   Arranges multi-column output across the page.

          The number of columns must be greater than 1. This number can be
          defined with -columns or -w.

          If a line is too long to fit in a column, it is truncated to the
          right. Truncation can be suppressed with -s.

          The -a option cannot be combined with the -m option.

          -a not specified:

          pr fills columns down the page from top to bottom.

     -d   Double-spaces the output. Blank lines that result from double-
          spacing are deleted when they occur at the top of a page.








Page 3                       Reliant UNIX 5.44                Printed 11/98

pr(1)                                                                 pr(1)

     -e[tabchar][spacing]
          Replaces each tab character in the input by an appropriate number
          of spaces.

          tabchar  Character which pr interprets as a tab character. May
                    be any non-numeric character.

                    tabchar not specified:

                    pr uses the horizontal tab character [see ascii(5)].

          spacing   Spacing between tabs. The first tab stop in a line is
                    always set in column 1. If spacing is 0, the default
                    value of 8 characters is assumed.

                    spacing not specified: The tab spacing is 8 characters.

     -f   Uses a single form-feed character to separate output pages [see
          ascii(5)].

          If the output is to a terminal, pr pauses before the first page
          and sounds the terminal bell. You then start the output by press-
          ing RETURN.

          -f not specified:

          Pages are separated by a sequence of line feed characters.

     -F   Pages are separated by a single form feed character.

          -F not specified:

          The pages are separated by a sequence of line feed characters.

     -h header
          Writes a text of your choice in the header instead of the file
          name. This option is ignored if you also specify -t or -l with a
          page length of 10 or less.

     -i[tabchar][spacing]
          Replaces white space in the input text with the tab character
          tabchar at appropriate positions in the output text.

          tabchar  Character which pr interprets as a tab character. May
                    be any non-numeric character.

                    tabchar not specified:

                    pr uses the horizontal tab character [see ascii(5)].





Page 4                       Reliant UNIX 5.44                Printed 11/98

pr(1)                                                                 pr(1)

          spacing   Spacing between tabs. The first tab stop in a line is
                    always set in column 1. If spacing is 0, the default
                    value of 8 characters is assumed.

                    spacing not specified: The tab spacing is 8 characters.

     -l length
          Sets the length of an output page.

          The page length includes a total of 10 lines for the header and
          footer. Consequently, if you specify a value of 10 or less for
          length, the header and trailer will not be output (see the -t
          option).

          -l not specified: Each page is made up of 66 lines.

     -m   Merges and outputs all named files simultaneously, one column per
          file. The maximum number of files that may be specified is nine.

          -m cannot be used together with -columns.

          Otherwise, the same rules apply as for -columns.

          The -m option cannot be combined with the -a option.

          -m not specified: pr outputs files one after the other.

     -n[separator][charpos]
          Numbers the lines. For multi-column output, the lines of each
          individual column are numbered. The line number occupies the
          first

          charpos+1 character positions of each line or each column line.

          separator Character used to separate the line number from the
                    start of the line. May be any non-numeric character.

                    separator not specified:

                    A horizontal tab is used as the separator [see
                    ascii(5)].

          charpos  Number of character positions occupied by line numbers.

                    charpos not specified: Defaults to 5.

     -o offset
          Offsets (indents) each output line by offset character positions.

     -p   If the output is directed to a terminal, pr sounds the terminal
          bell and pauses before beginning each page. The page is displayed
          after you press the RETURN key.


Page 5                       Reliant UNIX 5.44                Printed 11/98

pr(1)                                                                 pr(1)

     -r   Suppresses diagnostic reports if pr is unable to open a file.

          -r not specified:

          After completing the entire output, pr issues an error message to
          report files that could not be accessed.

     -s[separator]
          Separates columns by the single character separator instead of a
          tab. If you do not specify -w at the same time, -s also prevents
          the truncation of overlength lines (up to 512 characters) on
          multi-column output.

          separator Character used to separate columns.

                    separator not specified:

                    The default separator is a horizontal tab [see
                    ascii(5)].

     -t   Suppresses the headers and trailers. Terminates printing after
          the last line of each file instead of padding with blanks to the
          end of the page.

     -w width
          Sets the page width for multi-column output. Multi-column output
          can be produced with -columns or -m.

          width     Number of characters in a line.

          -w not specified:

          The default page width for multi-column output is 72 characters.

     -W   Fold the lines of the input file. When used in multi-column mode
          (with the -a or -m options) lines will be folded to fit the
          current column's width, otherwise they will be folded to fit the
          current line width (80 columns).

     --   If file begins with a dash (-), the end of the command-line
          options must be marked with --.

     file Name of the file to be prepared for printing. You may specify
          more than one file.

          If more than one file is specified, pr outputs them in succes-
          sion.

          If you use a dash as the name for file, pr reads from standard
          input.




Page 6                       Reliant UNIX 5.44                Printed 11/98

pr(1)                                                                 pr(1)

          If you use the -m option for multi-column output, no more than 9
          files may be specified.

          file not specified: pr reads from standard input.

EXAMPLES

     Example 1

     Print file1 and file2 sequentially in three-column format (-3) using
     the form-feed character (-f) at the end of each page so as to ensure
     that the output is independent of the printer type:

     $ pr -3f file1 file2 | lp

     Example 2

     The tab spacing of 8 positions in file1 is to be changed to 6 in
     file2. First you convert tabs in file1 to spaces (-e; tab spacing =
     8), then you reconvert the spaces back to tabs (-i6; tab spacing = 6),
     and then you write the result to file2. The -t option suppresses the
     header and trailer for both pr commands:

     $ pr -et file1 | pr -i6t > file2

     Example 3

     The file months contains the name of a month in each line. This file
     is now to be displayed with pr in three columns (-3) with two-digit
     numbering (-n2). The columns are to be filled from left to right (-a):

     $ pr -3n2a months

     Jun 17 11:09 1991    months Page 1

      1      January          2      February         3      March
      4      April            5      May              6      June
      7      July             8      August           9      September
     10      October         11      November        12      December

LOCALE
     The LCMESSAGES environment variable governs the language in which
     message texts are displayed.

     LCTIME governs the format of date and time strings in the headers.

     LCTYPE specifies which characters are viewed as non-printing charac-
     ters. Although non- printing characters appear in the standard output,
     they are not included in the calculation of line length and column
     width.




Page 7                       Reliant UNIX 5.44                Printed 11/98

pr(1)                                                                 pr(1)

     If LCMESSAGES, LCTIME or LCTYPE is undefined or is defined as the
     null string, it defaults to the value of LANG. If LANG is likewise
     undefined or null, the system acts as if it were not international-
     ized.

     The LCALL environment variable governs the entire locale. LCALL
     takes precedence over all the other environment variables which affect
     internationalization.

     If any of the locale variables has an invalid value, the system acts
     as if none of the variables were set.

FILES
     /dev/tty*

     /dev/term/tty*
          Special files for individual terminals.

          If standard output is directed to one of the special files
          /dev/tty*, other output directed to this terminal is delayed
          until standard output is completed. This prevents error messages
          from being interspersed throughout the output.

SEE ALSO
     cat(1), expand(1), fmt(1), fold(1), lp(1), more(1), page(1), pg(1),
     ascii(5).




























Page 8                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026