258 lines
8.7 KiB
HTML
258 lines
8.7 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||
|
<meta http-equiv="Content-Type" content=
|
||
|
"text/html; charset=utf-8">
|
||
|
<title>pr - Print files</title>
|
||
|
<LINK rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
||
|
</HEAD>
|
||
|
<body bgcolor="#FFFFFF">
|
||
|
<!-- Java sync-link -->
|
||
|
<SCRIPT LANGUAGE="Javascript" SRC="../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
|
||
|
|
||
|
|
||
|
|
||
|
<h2>pr - Print files</h2>
|
||
|
|
||
|
<strong>Synopsis</strong>
|
||
|
|
||
|
<p><strong>pr [+</strong><em>page</em><strong>]
|
||
|
[-</strong><em>column</em><strong>] [-adFmrt] [-e</strong>
|
||
|
[<em>char</em>][<em>gap</em>]<strong>] [-h</strong> <em>
|
||
|
header</em><strong>]
|
||
|
[-i[</strong><em>char</em>][<em>gap</em>]<strong>] [-l</strong>
|
||
|
<em>line</em><strong>]
|
||
|
[-n[</strong><em>char</em>][<em>width</em>]<strong>] [-o</strong>
|
||
|
<em>offset</em><strong>] [-s</strong>[<em>char</em>]<strong>]
|
||
|
[-w</strong> <em>width</em><strong>]</strong> [-] [<em>file</em>
|
||
|
...]</p>
|
||
|
|
||
|
<p><strong>Description</strong></p>
|
||
|
|
||
|
<p>The <strong>pr</strong> 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 path name of
|
||
|
the file and a 5-line trailer consisting of blank lines.
|
||
|
If the LC_TIME environment
|
||
|
variable is set, the date and time in the header is formatted using
|
||
|
the format specified by the d_t_fmt keyword in the LC_TIME category
|
||
|
of the specified locale.</p>
|
||
|
|
||
|
<p>When multiple column output is specified, text columns are of
|
||
|
equal width. By default text columns are separated by at least one
|
||
|
<space>. Input lines that do not fit into a text column are
|
||
|
truncated. Lines are not truncated under single column output.</p>
|
||
|
|
||
|
<p>Error messages are written to standard error during the printing
|
||
|
process (if output is redirected) or after all successful file
|
||
|
printing is complete (when printing to a terminal).</p>
|
||
|
|
||
|
<p>If <strong>pr</strong> receives an interrupt while printing to a
|
||
|
terminal, it flushes all accumulated error messages to the screen
|
||
|
before terminating.</p>
|
||
|
|
||
|
<p><strong>Options</strong></p>
|
||
|
|
||
|
<p><strong>Notes:</strong></p>
|
||
|
|
||
|
<ol>
|
||
|
<li>In the following option descriptions, <em>column</em>, <em>
|
||
|
lines</em>, <em>offset</em>, <em>page</em>, and <em>width</em> are
|
||
|
positive decimal integers and <em>gap</em> is a nonnegative decimal
|
||
|
integer.</li>
|
||
|
|
||
|
<li>The <strong>-s</strong> option does not allow the option letter
|
||
|
to be separated from its argument.</li>
|
||
|
|
||
|
<li>The <strong>-e</strong>, <strong>-i</strong>, and <strong>
|
||
|
-n</strong> options require that both arguments, if present, not be
|
||
|
separated from the option letter.</li>
|
||
|
</ol>
|
||
|
|
||
|
<dl>
|
||
|
<dt><strong>+</strong><em>page</em></dt>
|
||
|
|
||
|
<dd>Begin output at page number <em>page</em> of the formatted
|
||
|
input.</dd>
|
||
|
|
||
|
<dt><strong>-</strong><em>column</em></dt>
|
||
|
|
||
|
<dd>Produce output that is <em>columns</em> wide (default is 1)
|
||
|
that is written vertically down each column in the order in which
|
||
|
the text is received from the input file. The options <strong>
|
||
|
-e</strong> and <strong>-i</strong> are assumed. This option should
|
||
|
not be used with the <strong>-m</strong> option. When used with the
|
||
|
<strong>-t</strong> option the minimum number of lines is used to
|
||
|
display the output.</dd>
|
||
|
|
||
|
<dt><strong>-a</strong></dt>
|
||
|
|
||
|
<dd>Modify the effect of the <strong>column</strong> option so that
|
||
|
the columns are filled across the page in a round-robin order
|
||
|
(for example, 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,
|
||
|
and so on). This option requires the use of the <strong>column</strong>
|
||
|
option.</dd>
|
||
|
|
||
|
<dt><strong>-d</strong></dt>
|
||
|
|
||
|
<dd>Produce output that is double spaced. An extra <newline>
|
||
|
character is output following every <newline> found in the
|
||
|
input.</dd>
|
||
|
|
||
|
<dt><strong>-e</strong> [<em>char</em>][<em>gap</em>]</dt>
|
||
|
|
||
|
<dd>Expand each input <tab> to the next greater column
|
||
|
position specified by the formula n*<em>gap</em>+1, where <em>
|
||
|
n</em> is an integer > 0. If <em>gap</em> 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, <em>char</em>, is specified, it is used as the
|
||
|
input tab character.</dd>
|
||
|
|
||
|
<dt><strong>-F</strong></dt>
|
||
|
|
||
|
<dd>Use a <form-feed> character for new pages, instead of the
|
||
|
default behavior that uses a sequence of <newline>
|
||
|
characters.</dd>
|
||
|
|
||
|
<dt><strong>-h</strong> <em>header</em></dt>
|
||
|
|
||
|
<dd>Use the string <em>header</em> to replace the file name in the
|
||
|
header line.</dd>
|
||
|
|
||
|
<dt><strong>-i</strong> [<em>char</em>][<em>gap</em>]</dt>
|
||
|
|
||
|
<dd>In output, replace multiple <space>s with <tab>s
|
||
|
whenever two or more adjacent <space>s reach column positions
|
||
|
<em>gap</em>+1, 2*<em>gap</em>+1, and so on. If <em>gap</em> is zero or
|
||
|
omitted, default <tab> settings at every eighth column
|
||
|
position is used. If any nondigit character, <em>char</em>, is
|
||
|
specified, it is used as the output <tab> character.</dd>
|
||
|
|
||
|
<dt><strong>-l</strong> <em>lines</em></dt>
|
||
|
|
||
|
<dd>Override the 66 line default and reset the page length to <em>
|
||
|
lines</em>. If <em>lines</em> is not greater than the sum of both
|
||
|
the header and trailer depths (in lines), the <strong>pr</strong>
|
||
|
utility suppresses output of both the header and trailer, as if the
|
||
|
<strong>-t</strong> option were in effect.</dd>
|
||
|
|
||
|
<dt><strong>-m</strong></dt>
|
||
|
|
||
|
<dd>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
|
||
|
positions. 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
|
||
|
options <strong>-e</strong> and <strong>i</strong> are
|
||
|
assumed.</dd>
|
||
|
|
||
|
<dt><strong>-n</strong> [<em>char</em>][<em>width</em>]</dt>
|
||
|
|
||
|
<dd>Provide <em>width</em> digit line numbering. The default for
|
||
|
<em>width</em>, if not specified, is 5. The number occupies the
|
||
|
first <em>width</em> column positions of each text column or each
|
||
|
line of <strong>-m</strong> output. If <em>char</em> (any nondigit
|
||
|
character) is given, it is appended to the line number to separate
|
||
|
it from whatever follows. The default for <em>char</em> is a
|
||
|
<tab>. Line numbers longer than <em>width</em> columns are
|
||
|
truncated.</dd>
|
||
|
|
||
|
<dt><strong>-o</strong> <em>offset</em></dt>
|
||
|
|
||
|
<dd>Each line of output is preceded by <em>offset</em>
|
||
|
<spaces>s. If this option is not specified, the default is
|
||
|
zero. The space taken is in addition to the output line width.</dd>
|
||
|
|
||
|
<dt><strong>-r</strong></dt>
|
||
|
|
||
|
<dd>Write no diagnostic reports on failure to open a file.</dd>
|
||
|
|
||
|
<dt><strong>-s</strong> <em>char</em></dt>
|
||
|
|
||
|
<dd>Separate text columns by the single character <em>char</em>
|
||
|
instead of by the appropriate number of <space>s (default for
|
||
|
<em>char</em> is the <tab> character).</dd>
|
||
|
|
||
|
<dt><strong>-t</strong></dt>
|
||
|
|
||
|
<dd>Print neither the five-line identifying header nor the
|
||
|
five-line trailer typically supplied for each page. Quit printing
|
||
|
after the last line of each file without spacing to the end of the
|
||
|
page.</dd>
|
||
|
|
||
|
<dt><strong>-w</strong> <em>width</em></dt>
|
||
|
|
||
|
<dd>Set the width of the line to <em>width</em> column positions
|
||
|
for multiple text-column output only. If this option is not
|
||
|
specified and the <strong>-s</strong> option is not specified, the
|
||
|
default width is 72. If this option is not specified and the
|
||
|
<strong>-s</strong> option is specified, the default width is
|
||
|
512.</dd>
|
||
|
</dl>
|
||
|
|
||
|
<p><strong>Operands</strong></p>
|
||
|
|
||
|
<p>Each <em>file</em> is a path name of a file to be printed. If no
|
||
|
<em>file</em> operands are specified, or if a <em>file</em> operand
|
||
|
is -, the standard input is used.</p>
|
||
|
|
||
|
<p><strong>Environment Variables</strong></p>
|
||
|
|
||
|
<p><strong>pr</strong> is affected by the following environment
|
||
|
variables:</p>
|
||
|
|
||
|
<dl>
|
||
|
<dt><strong>LANG</strong></dt>
|
||
|
|
||
|
<dd>Provides a default value for locale categories that are not specifically
|
||
|
set with a variable starting with LC_.</dd>
|
||
|
|
||
|
<dt><strong>LC_TIME</strong></dt>
|
||
|
|
||
|
<dd>Defines the format of the date and time used in writing header lines.</dd>
|
||
|
|
||
|
</dl>
|
||
|
|
||
|
<p><strong>Exit Status</strong></p>
|
||
|
|
||
|
<ul>
|
||
|
<li>0 on success</li>
|
||
|
|
||
|
<li>>0 if an error occurs</li>
|
||
|
</ul>
|
||
|
|
||
|
<p><strong>Related information</strong></p>
|
||
|
|
||
|
<ul>
|
||
|
<li><a href="cat.htm">cat - Concatenate and print files</a></li>
|
||
|
|
||
|
<li><a href="od.htm">od - Dump files in various formats</a></li>
|
||
|
</ul>
|
||
|
|
||
|
<p><strong>Examples</strong></p>
|
||
|
|
||
|
<ol>
|
||
|
<li>Print a file starting at page 3:
|
||
|
|
||
|
<pre>
|
||
|
pr +3 source.java
|
||
|
</pre>
|
||
|
</li>
|
||
|
|
||
|
<li>Print every *.java file and change the header message:
|
||
|
|
||
|
<pre>
|
||
|
pr -h 'JDK source files and examples' code/*.java
|
||
|
</pre>
|
||
|
</li>
|
||
|
</ol>
|
||
|
</body>
|
||
|
</html>
|
||
|
|