coreutils: pr invocation

1 
1 4.2 ‘pr’: Paginate or columnate files for printing
1 ==================================================
1 
1 ‘pr’ writes each FILE (‘-’ means standard input), or standard input if
1 none are given, to standard output, paginating and optionally outputting
1 in multicolumn format; optionally merges all FILEs, printing all in
1 parallel, one per column.  Synopsis:
1 
1      pr [OPTION]... [FILE]...
1 
1    By default, a 5-line header is printed at each page: two blank lines;
1 a line with the date, the file name, and the page count; and two more
1 blank lines.  A footer of five blank lines is also printed.  The default
1 PAGE_LENGTH is 66 lines.  The default number of text lines is therefore
1 56.  The text line of the header takes the form ‘DATE STRING PAGE’, with
1 spaces inserted around STRING so that the line takes up the full
1 PAGE_WIDTH.  Here, DATE is the date (see the ‘-D’ or ‘--date-format’
1 option for details), STRING is the centered header string, and PAGE
1 identifies the page number.  The ‘LC_MESSAGES’ locale category affects
1 the spelling of PAGE; in the default C locale, it is ‘Page NUMBER’ where
1 NUMBER is the decimal page number.
1 
1    Form feeds in the input cause page breaks in the output.  Multiple
1 form feeds produce empty pages.
1 
1    Columns are of equal width, separated by an optional string (default
1 is ‘space’).  For multicolumn output, lines will always be truncated to
1 PAGE_WIDTH (default 72), unless you use the ‘-J’ option.  For single
1 column output no line truncation occurs by default.  Use ‘-W’ option to
1 truncate lines in that case.
1 
11    The program accepts the following options.  Also see ⇒Common
 options.
1 
1 ‘+FIRST_PAGE[:LAST_PAGE]’
1 ‘--pages=FIRST_PAGE[:LAST_PAGE]’
1      Begin printing with page FIRST_PAGE and stop with LAST_PAGE.
1      Missing ‘:LAST_PAGE’ implies end of file.  While estimating the
1      number of skipped pages each form feed in the input file results in
1      a new page.  Page counting with and without ‘+FIRST_PAGE’ is
1      identical.  By default, counting starts with the first page of
1      input file (not first page printed).  Line numbering may be altered
1      by ‘-N’ option.
1 
1 ‘-COLUMN’
1 ‘--columns=COLUMN’
1      With each single FILE, produce COLUMN columns of output (default is
1      1) and print columns down, unless ‘-a’ is used.  The column width
1      is automatically decreased as COLUMN increases; unless you use the
1      ‘-W/-w’ option to increase PAGE_WIDTH as well.  This option might
1      well cause some lines to be truncated.  The number of lines in the
1      columns on each page are balanced.  The options ‘-e’ and ‘-i’ are
1      on for multiple text-column output.  Together with ‘-J’ option
1      column alignment and line truncation is turned off.  Lines of full
1      length are joined in a free field format and ‘-S’ option may set
1      field separators.  ‘-COLUMN’ may not be used with ‘-m’ option.
1 
1 ‘-a’
1 ‘--across’
1      With each single FILE, print columns across rather than down.  The
1      ‘-COLUMN’ option must be given with COLUMN greater than one.  If a
1      line is too long to fit in a column, it is truncated.
1 
1 ‘-c’
1 ‘--show-control-chars’
1      Print control characters using hat notation (e.g., ‘^G’); print
1      other nonprinting characters in octal backslash notation.  By
1      default, nonprinting characters are not changed.
1 
1 ‘-d’
1 ‘--double-space’
1      Double space the output.
1 
1 ‘-D FORMAT’
1 ‘--date-format=FORMAT’
1      Format header dates using FORMAT, using the same conventions as for
1      the command ‘date +FORMAT’.  ⇒date invocation.  Except for
1      directives, which start with ‘%’, characters in FORMAT are printed
1      unchanged.  You can use this option to specify an arbitrary string
1      in place of the header date, e.g., ‘--date-format="Monday
1      morning"’.
1 
1      The default date format is ‘%Y-%m-%d %H:%M’ (for example,
1      ‘2001-12-04 23:59’); but if the ‘POSIXLY_CORRECT’ environment
1      variable is set and the ‘LC_TIME’ locale category specifies the
1      POSIX locale, the default is ‘%b %e %H:%M %Y’ (for example, ‘Dec  4
1      23:59 2001’.
1 
1      Timestamps are listed according to the time zone rules specified by
1      the ‘TZ’ environment variable, or by the system default rules if
11      ‘TZ’ is not set.  ⇒Specifying the Time Zone with ‘TZ’
      (libc)TZ Variable.
1 
1 ‘-e[IN-TABCHAR[IN-TABWIDTH]]’
1 ‘--expand-tabs[=IN-TABCHAR[IN-TABWIDTH]]’
1      Expand TABs to spaces on input.  Optional argument IN-TABCHAR is
1      the input tab character (default is the TAB character).  Second
1      optional argument IN-TABWIDTH is the input tab character’s width
1      (default is 8).
1 
1 ‘-f’
1 ‘-F’
1 ‘--form-feed’
1      Use a form feed instead of newlines to separate output pages.  This
1      does not alter the default page length of 66 lines.
1 
1 ‘-h HEADER’
1 ‘--header=HEADER’
1      Replace the file name in the header with the centered string
1      HEADER.  When using the shell, HEADER should be quoted and should
1      be separated from ‘-h’ by a space.
1 
1 ‘-i[OUT-TABCHAR[OUT-TABWIDTH]]’
1 ‘--output-tabs[=OUT-TABCHAR[OUT-TABWIDTH]]’
1      Replace spaces with TABs on output.  Optional argument OUT-TABCHAR
1      is the output tab character (default is the TAB character).  Second
1      optional argument OUT-TABWIDTH is the output tab character’s width
1      (default is 8).
1 
1 ‘-J’
1 ‘--join-lines’
1      Merge lines of full length.  Used together with the column options
1      ‘-COLUMN’, ‘-a -COLUMN’ or ‘-m’.  Turns off ‘-W/-w’ line
1      truncation; no column alignment used; may be used with
1      ‘--sep-string[=STRING]’.  ‘-J’ has been introduced (together with
1      ‘-W’ and ‘--sep-string’) to disentangle the old (POSIX-compliant)
1      options ‘-w’ and ‘-s’ along with the three column options.
1 
1 ‘-l PAGE_LENGTH’
1 ‘--length=PAGE_LENGTH’
1      Set the page length to PAGE_LENGTH (default 66) lines, including
1      the lines of the header [and the footer].  If PAGE_LENGTH is less
1      than or equal to 10, the header and footer are omitted, as if the
1      ‘-t’ option had been given.
1 
1 ‘-m’
1 ‘--merge’
1      Merge and print all FILEs in parallel, one in each column.  If a
1      line is too long to fit in a column, it is truncated, unless the
1      ‘-J’ option is used.  ‘--sep-string[=STRING]’ may be used.  Empty
1      pages in some FILEs (form feeds set) produce empty columns, still
1      marked by STRING.  The result is a continuous line numbering and
1      column marking throughout the whole merged file.  Completely empty
1      merged pages show no separators or line numbers.  The default
1      header becomes ‘DATE PAGE’ with spaces inserted in the middle; this
1      may be used with the ‘-h’ or ‘--header’ option to fill up the
1      middle blank part.
1 
1 ‘-n[NUMBER-SEPARATOR[DIGITS]]’
1 ‘--number-lines[=NUMBER-SEPARATOR[DIGITS]]’
1      Provide DIGITS digit line numbering (default for DIGITS is 5).
1      With multicolumn output the number occupies the first DIGITS column
1      positions of each text column or only each line of ‘-m’ output.
1      With single column output the number precedes each line just as
1      ‘-m’ does.  Default counting of the line numbers starts with the
1      first line of the input file (not the first line printed, compare
1      the ‘--page’ option and ‘-N’ option).  Optional argument
1      NUMBER-SEPARATOR is the character appended to the line number to
1      separate it from the text followed.  The default separator is the
1      TAB character.  In a strict sense a TAB is always printed with
1      single column output only.  The TAB width varies with the TAB
1      position, e.g., with the left MARGIN specified by ‘-o’ option.
1      With multicolumn output priority is given to ‘equal width of output
1      columns’ (a POSIX specification).  The TAB width is fixed to the
1      value of the first column and does not change with different values
1      of left MARGIN.  That means a fixed number of spaces is always
1      printed in the place of the NUMBER-SEPARATOR TAB.  The tabification
1      depends upon the output position.
1 
1 ‘-N LINE_NUMBER’
1 ‘--first-line-number=LINE_NUMBER’
1      Start line counting with the number LINE_NUMBER at first line of
1      first page printed (in most cases not the first line of the input
1      file).
1 
1 ‘-o MARGIN’
1 ‘--indent=MARGIN’
1      Indent each line with a margin MARGIN spaces wide (default is
1      zero).  The total page width is the size of the margin plus the
1      PAGE_WIDTH set with the ‘-W/-w’ option.  A limited overflow may
1      occur with numbered single column output (compare ‘-n’ option).
1 
1 ‘-r’
1 ‘--no-file-warnings’
1      Do not print a warning message when an argument FILE cannot be
1      opened.  (The exit status will still be nonzero, however.)
1 
1 ‘-s[CHAR]’
1 ‘--separator[=CHAR]’
1      Separate columns by a single character CHAR.  The default for CHAR
1      is the TAB character without ‘-w’ and ‘no character’ with ‘-w’.
1      Without ‘-s’ the default separator ‘space’ is set.  ‘-s[char]’
1      turns off line truncation of all three column options
1      (‘-COLUMN’|‘-a -COLUMN’|‘-m’) unless ‘-w’ is set.  This is a
1      POSIX-compliant formulation.
1 
1 ‘-S[STRING]’
1 ‘--sep-string[=STRING]’
1      Use STRING to separate output columns.  The ‘-S’ option doesn’t
1      affect the ‘-W/-w’ option, unlike the ‘-s’ option which does.  It
1      does not affect line truncation or column alignment.  Without ‘-S’,
1      and with ‘-J’, ‘pr’ uses the default output separator, TAB.
1      Without ‘-S’ or ‘-J’, ‘pr’ uses a ‘space’ (same as ‘-S" "’).  If no
1      ‘STRING’ argument is specified, ‘""’ is assumed.
1 
1 ‘-t’
1 ‘--omit-header’
1      Do not print the usual header [and footer] on each page, and do not
1      fill out the bottom of pages (with blank lines or a form feed).  No
1      page structure is produced, but form feeds set in the input files
1      are retained.  The predefined pagination is not changed.  ‘-t’ or
1      ‘-T’ may be useful together with other options; e.g.: ‘-t -e4’,
1      expand TAB characters in the input file to 4 spaces but don’t make
1      any other changes.  Use of ‘-t’ overrides ‘-h’.
1 
1 ‘-T’
1 ‘--omit-pagination’
1      Do not print header [and footer].  In addition eliminate all form
1      feeds set in the input files.
1 
1 ‘-v’
1 ‘--show-nonprinting’
1      Print nonprinting characters in octal backslash notation.
1 
1 ‘-w PAGE_WIDTH’
1 ‘--width=PAGE_WIDTH’
1      Set page width to PAGE_WIDTH characters for multiple text-column
1      output only (default for PAGE_WIDTH is 72).  The specified
1      PAGE_WIDTH is rounded down so that columns have equal width.
1      ‘-s[CHAR]’ turns off the default page width and any line truncation
1      and column alignment.  Lines of full length are merged, regardless
1      of the column options set.  No PAGE_WIDTH setting is possible with
1      single column output.  A POSIX-compliant formulation.
1 
1 ‘-W PAGE_WIDTH’
1 ‘--page_width=PAGE_WIDTH’
1      Set the page width to PAGE_WIDTH characters, honored with and
1      without a column option.  With a column option, the specified
1      PAGE_WIDTH is rounded down so that columns have equal width.  Text
1      lines are truncated, unless ‘-J’ is used.  Together with one of the
1      three column options (‘-COLUMN’, ‘-a -COLUMN’ or ‘-m’) column
1      alignment is always used.  The separator options ‘-S’ or ‘-s’ don’t
1      disable the ‘-W’ option.  Default is 72 characters.  Without ‘-W
1      PAGE_WIDTH’ and without any of the column options NO line
1      truncation is used (defined to keep downward compatibility and to
1      meet most frequent tasks).  That’s equivalent to ‘-W 72 -J’.  The
1      header line is never truncated.
1 
1    An exit status of zero indicates success, and a nonzero value
1 indicates failure.
1