icon Top 9 categories map      RocketAware >


Tips: Browse or Search all pages for efficient awareness of more than 6000 of the most popular reusable and open source applications, functions, libraries, and FAQs.

The "RKT couplings" below include links to source code, updates, additional information, advice, FAQs, and overviews.


Search all pages


By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Integer, Floating point, Matrix, Statistics, Boolean, ...

Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...


RocketLink!--> Man page versions: OpenBSD FreeBSD NetBSD RedHat Solaris Others

[IEEE Std1003.2-1992 (``POSIX.2'')]

PR(1)                      OpenBSD Reference Manual                      PR(1)

     pr - print files

     pr [+page] [-column] [-adfFmrt] [[-e] [char] [gap]] [-h header] [[-i]
        [char] [gap]] [-l lines] [-o offset] [[-s] [char]] [[-n] [char]
        [width]] [-w width] [-] [file ...]

     The pr utility is a printing and pagination filter for text files.  When
     multiple input files are specified, each is read, formatted, and written
     to standard output.  By default, the input is separated into 66-line
     pages, each with

     - A 5-line header with the page number, date, time, and the pathname of
       the file.

     - A 5-line trailer consisting of blank lines.

     Optionally, the trailer can be replaced by a <form-feed> where this is
     more appropriate for the output device being used and <tab>s can be ex-
     panded to input relative <spaces>s or <space>s can contracted to output
     relative <tab>s. The pr utility also interprets <form-feed>s in the input
     as logical end of pages.

     When multiple column output is specified, text columns are of equal
     width.  By default text columns are separated by at least one <blank>.
     Input lines that do not fit into a text column are truncated, except in
     the default single columns output mode.

     If standard output is associated with a terminal, diagnostic messages are
     suppressed until the pr utility has completed processing.

     In the following option descriptions, column, lines, offset, page, and
     width are positive decimal integers and gap is a non-negative decimal in-

           Begin output at page number page of the formatted input.

           Produce output that is columns wide (default is 1) that is written
           vertically down each column in the order in which the text is re-
           ceived from the input file.  The options -e and -i are assumed.
           This option should not be used with -m. When used with -t, the min-
           imum number of lines is used to display the output.

     -a    Modify the effect of the -column option so that the columns are
           filled across the page in a round-robin order (e.g., when column is
           2, the first input line heads column 1, the second heads column 2,
           the third is the second line in column 1, etc.).  This option re-
           quires the use of the -column option.

     -d    Produce output that is double spaced. An extra <newline> character
           is output following every <newline> found in the input.

     -e [char][gap]
           Expand each input <tab> to the next greater column position speci-
           fied by the formula n*gap+1, where n is an integer > 0.  If gap is
           zero or is omitted the default is 8.  All <tab> characters in the
           input are expanded into the appropriate number of <space>s. If any
           nondigit character, char, is specified, it is used as the input tab


     -F    Use a <form-feed> character for new pages, instead of the default
           behavior that uses a sequence of <newline> characters.

     -f    Same as the -F option.

     -h header
           Use the string header to replace the file name in the header line.

     -i [char][gap]
           In output, replace multiple <space>s with <tab>s whenever two or
           more adjacent <space>s reach column positions gap+1, 2*gap+1, etc.
           If gap is zero or omitted, default <tab> settings at every eighth
           column position is used.  If any nondigit character, char, is spec-
           ified, it is used as the output <tab> character.

     -l lines
           Override the 66 line default and reset the page length to lines. If
           lines is not greater than the sum of both the header and trailer
           depths (in lines), the pr utility suppresses output of both the
           header and trailer, as if the -t option were in effect.

     -m    Merge the contents of multiple files.  One line from each file
           specified by a file operand is written side by side into text
           columns of equal fixed widths, in terms of the number of column po-
           sitions.  The number of text columns depends on the number of file
           operands successfully opened.  The maximum number of files merged
           depends on page width and the per process open file limit.  The op-
           tions -e and -i are assumed.

     -n [char][width]
           Provide width digit line numbering.  The default for width, if not
           specified, is 5.  The number occupies the first width column posi-
           tions of each text column or each line of -m output.  If char (any
           nondigit character) is given, it is appended to the line number to
           separate it from whatever follows. The default for char is a <tab>.
           Line numbers longer than width columns are truncated.

     -o offset
           Each line of output is preceded by offset <spaces>s. If the -o op-
           tion is not specified, the default is zero.  The space taken is in
           addition to the output line width.

     -r    Write no diagnostic reports on failure to open a file.

     -s char
           Separate text columns by the single character char instead of by
           the appropriate number of <space>s (default for char is the <tab>

     -t    Print neither the five-line identifying header nor the five-line
           trailer usually supplied for each page.  Quit printing after the
           last line of each file without spacing to the end of the page.

     -w width
           Set the width of the line to width column positions for multiple
           text-column output only.  If the -w option is not specified and the
           -s option is not specified, the default width is 72.  If the -w op-
           tion is not specified and the -s option is specified, the default
           width is 512.

     file  A pathname of a file to be printed.  If no file operands are speci-
           fied, or if a file operand is `-', the standard input is used.  The
           standard input is used only if no file operands are specified, or
           if a file operand is `-'.

     The -s option does not allow the option letter to be separated from its
     argument, and the options -e, -i, and -n require that both arguments, if
     present, not be separated from the option letter.

     If pr receives an interrupt while printing to a terminal, it flushes all
     accumulated error messages to the screen before terminating.

     The pr utility exits 0 on success, and 1 if an error occurs.

     Error messages are written to standard error during the printing process
     (if output is redirected) or after all successful file printing is com-
     plete (when printing to a terminal).

     The interpretation of <form-feed>s in the input stream is that they are
     special <newline>s which have the side effect of causing a page break.
     While this works correctly for all cases, strict interpretation also im-
     plies that the common convention of placing a <form-feed> on a line by
     itself is actually interpreted as a blank line, page break, blank line.

     The pr utility is intended to paginate input containing basic ascii(7)
     text formatting and input streams containing non-printing <control-
     characters>, <escape-sequences> or long lines may result in formatting

     The pr utility does not currently understand over-printing using <back-
     space> or <return> characters, and except in the case of unmodified sin-
     gle-column output, use of these characters will cause formatting errors.

     The lack of a line wrapping option, and the specification that truncation
     does not apply to single-column output frequently results in formatting
     errors when input lines are longer than actual line width of the output

     The default width of 72 is archaic and non-obvious since it is normally
     ignored in the default single column mode.  Using the -m option with one
     column provides a way to truncate single column output but there's no way
     to wrap long times to a fixed line width.

     The default of <tab> for the separator for the -n and -s options often
     results in lines apparently wider than expected.

     cat(1),  more(1),  ascii(7)

     The pr utility is IEEE Std1003.2 (``POSIX.2'') compatible; however, that
     standard is relatively silent concerning the handling of input characters
     beyond the behavior dictated by the pr required command options.

OpenBSD 2.6                      June 6, 1993                                3

Source: OpenBSD 2.6 man pages. Copyright: Portions are copyrighted by BERKELEY
SOFTWARE DESIGN, INC., The Regents of the University of California, Massachusetts
Institute of Technology, Free Software Foundation, FreeBSD Inc., and others.

(Corrections, notes, and links courtesy of RocketAware.com)

[Detailed Topics]
FreeBSD Sources for pr(1)
OpenBSD sources for pr(1)

[Overview Topics]

Up to: Text File Output - Methods of printing and displaying text files.
Up to: Printing and Printer Interface

RocketLink!--> Man page versions: OpenBSD FreeBSD NetBSD RedHat Solaris Others

[IEEE Std1003.2-1992 (``POSIX.2'')]

Rapid-Links: Search | About | Comments | Submit Path: RocketAware > pr.1/
RocketAware.com is a service of Mib Software
Copyright 1999, Forrest J. Cavalier III. All Rights Reserved.
We welcome submissions and comments