xref: /freebsd/usr.bin/pr/pr.1 (revision 417ed37975261df51f61d13e179ad04d8f4839c7)
1.\" Copyright (c) 1991 Keith Muller.
2.\" Copyright (c) 1993
3.\"	The Regents of the University of California.  All rights reserved.
4.\"
5.\" This code is derived from software contributed to Berkeley by
6.\" Keith Muller of the University of California, San Diego.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\" 3. All advertising materials mentioning features or use of this software
17.\"    must display the following acknowledgement:
18.\"	This product includes software developed by the University of
19.\"	California, Berkeley and its contributors.
20.\" 4. Neither the name of the University nor the names of its contributors
21.\"    may be used to endorse or promote products derived from this software
22.\"    without specific prior written permission.
23.\"
24.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34.\" SUCH DAMAGE.
35.\"
36.\"     @(#)pr.1	8.3 (Berkeley) 4/18/94
37.\"
38.Dd April 18, 1994
39.Dt PR 1
40.Os BSD 4.4
41.Sh NAME
42.Nm pr
43.Nd print files
44.Sh SYNOPSIS
45.Nm pr
46.Bk -words
47.Op Ar \&+page
48.Ek
49.Bk -words
50.Op Fl Ar column
51.Ek
52.Op Fl adFmrt
53.Bk -words
54.Oo
55.Op Fl e
56.Op Ar char
57.Op Ar gap
58.Oc
59.Ek
60.Bk -words
61.Op Fl h Ar header
62.Ek
63.Bk -words
64.Oo
65.Op Fl i
66.Op Ar char
67.Op Ar gap
68.Oc
69.Ek
70.Bk -words
71.Op Fl l Ar lines
72.Ek
73.Bk -words
74.Op Fl o Ar offset
75.Ek
76.Bk -words
77.Oo
78.Op Fl s
79.Op Ar char
80.Oc
81.Ek
82.Bk -words
83.Oo
84.Op Fl n
85.Op Ar char
86.Op Ar width
87.Oc
88.Ek
89.Bk -words
90.Op Fl w Ar width
91.Ek
92.Op -
93.Op Ar file ...
94.Sh DESCRIPTION
95The
96.Nm pr
97utility is a printing and pagination filter for text files.
98When multiple input files are specified, each is read, formatted,
99and written to standard output.
100By default, the input is separated into 66-line pages, each with
101.sp
102.in +2
103.ti -2
104\(bu A 5-line header with the page number, date, time, and
105the pathname of the file.
106.sp
107.ti -2
108\(bu A 5-line trailer consisting of blank lines.
109.in -2
110.Pp
111If standard output is associated with a terminal,
112diagnostic messages are suppressed until the
113.Nm pr
114utility has completed processing.
115.Pp
116When multiple column output is specified,
117text columns are of equal width.
118By default text columns are separated by at least one
119.Em <blank>.
120Input lines that do not fit into a text column are truncated.
121Lines are not truncated under single column output.
122.Sh OPTIONS
123.Pp
124In the following option descriptions, column, lines, offset, page, and
125width are positive decimal integers and gap is a nonnegative decimal integer.
126.Bl -tag -width 4n
127.It Ar \&+page
128Begin output at page number
129.Ar page
130of the formatted input.
131.It Fl Ar column
132Produce output that is
133.Ar columns
134wide (default is 1) that is written vertically
135down each column in the order in which the text
136is received from the input file.
137The options
138.Fl e
139and
140.Fl i
141are assumed.
142This option should not be used with
143.Fl m .
144When used with
145.Fl t ,
146the minimum number of lines is used to display the output.
147.It Fl a
148Modify the effect of the
149.Fl column
150option so that the columns are filled across the page in a round-robin order
151(e.g., when column is 2, the first input line heads column
1521, the second heads column 2, the third is the second line
153in column 1, etc.).
154This option requires the use of the
155.Fl column
156option.
157.It Fl d
158Produce output that is double spaced. An extra
159.Em <newline>
160character is output following every <newline> found in the input.
161.It Fl e Ar \&[char\&]\&[gap\&]
162Expand each input <tab> to the next greater column
163position specified by the formula
164.Ar n*gap+1 ,
165where
166.Em n
167is an integer > 0.
168If
169.Ar gap
170is zero or is omitted the default is 8.
171All
172.Em <tab>
173characters in the input are expanded into the appropriate
174number of
175.Em <space>s .
176If any nondigit character,
177.Ar char ,
178is specified, it is used as the input tab character.
179.It Fl F
180Use a
181.Em <form-feed>
182character for new pages,
183instead of the default behavior that uses a
184sequence o
185.Em <newline>
186characters.
187.It Fl h Ar header
188.Ar header
189Use the string
190.Ar header
191to replace the
192.Ar file name
193in the header line.
194.It Fl i Ar \&[char\&]\&[gap\&]
195In output, replace multiple <space>s with <tab>s whenever two or more
196adjacent <space>s reach column positions
197.Ar gap+1 ,
198.Ar 2*gap+1 ,
199etc.
200If
201.Ar gap
202is zero or omitted, default
203.Em <tab>
204settings at every eighth column position
205is used.
206If any nondigit character,
207.Ar char ,
208is specified, it is used as the output
209.Em <tab>
210character.
211.It Fl l Ar lines
212Override the 66 line default and reset the page length to
213.Ar lines.
214If
215.Ar lines
216is not greater than the sum of both the header and trailer
217depths (in lines), the
218.Nm pr
219utility suppresses output of both the header and trailer, as if the
220.Fl t
221option were in effect.
222.It Fl m
223Merge the contents of multiple files.
224One line from each file specified by a file operand is
225written side by side into text columns of equal fixed widths, in
226terms of the number of column positions.
227The number of text columns depends on the number of
228file operands successfully opened.
229The maximum number of files merged depends on page width and the
230per process open file limit.
231The options
232.Fl e
233and
234.Fl i
235are assumed.
236.It Fl n Ar \&[char\&]\&[width\&]
237Provide
238.Ar width
239digit line numbering.
240The default for
241.Ar width ,
242if not specified, is 5.
243The number occupies the first
244.Ar width
245column positions of each text column or each line of
246.Fl m
247output.
248If
249.Ar char
250(any nondigit character) is given, it is appended to the line number to
251separate it from whatever follows. The default for
252.Ar char
253is a
254.Em <tab> .
255Line numbers longer than
256.Ar width
257columns are truncated.
258.It Fl o Ar offset
259Each line of output is preceded by
260.Ar offset
261.Em <spaces>s .
262If the
263.FL o
264option is not specified, the default is zero.
265The space taken is in addition to the output line width.
266.It Fl r
267Write no diagnostic reports on failure to open a file.
268.It Fl s Ar char
269Separate text columns by the single character
270.Ar char
271instead of by the appropriate number of
272.Em <space>s
273(default for
274.Ar char
275is the
276.Em <tab>
277character).
278.It Fl t
279Print neither the five-line identifying
280header nor the five-line trailer usually supplied for each page.
281Quit printing after the last line of each file without spacing to the
282end of the page.
283.It Fl w Ar width
284Set the width of the line to
285.Ar width
286column positions for multiple text-column output only.
287If the
288.Fl w
289option is not specified and the
290.Fl s
291option is not specified, the default width is 72.
292If the
293.Fl w
294option is not specified and the
295.Fl s
296option is specified, the default width is 512.
297.It Ar file
298A pathname of a file to be printed.
299If no
300.Ar file
301operands are specified, or if a
302.Ar file
303operand is
304.Sq Fl ,
305the standard input is used.
306The standard input is used only if no
307.Ar file
308operands are specified, or if a
309.Ar file
310operand is
311.Sq Fl .
312.El
313.Pp
314The
315.Fl s
316option does not allow the option letter to be separated from its
317argument, and the options
318.Fl e ,
319.Fl i ,
320and
321.Fl n
322require that both arguments, if present, not be separated from the option
323letter.
324.Sh ERRORS
325.Pp
326If
327.Nm pr
328receives an interrupt while printing to a terminal, it
329flushes all accumulated error messages to the screen before
330terminating.
331.Pp
332The
333.Nm pr
334utility exits 0 on success, and 1 if an error occurs.
335.Pp
336Error messages are written to standard error during the printing
337process (if output is redirected) or after all successful
338file printing is complete (when printing to a terminal).
339.Sh SEE ALSO
340.Xr cat 1 ,
341.Xr more 1
342.Sh STANDARDS
343The
344.Nm pr
345utility is
346.St -p1003.2
347compatible.
348