xref: /freebsd/usr.bin/pr/pr.1 (revision 23f282aa31e9b6fceacd449020e936e98d6f2298)
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.\" $FreeBSD$
38.\"
39.Dd April 18, 1994
40.Dt PR 1
41.Os BSD 4.4
42.Sh NAME
43.Nm pr
44.Nd print files
45.Sh SYNOPSIS
46.Nm
47.Bk -words
48.Op Ar \&+page
49.Ek
50.Bk -words
51.Op Fl Ar column
52.Ek
53.Op Fl adFmrt
54.Bk -words
55.Oo
56.Op Fl e
57.Op Ar char
58.Op Ar gap
59.Oc
60.Ek
61.Bk -words
62.Op Fl L Ar locale
63.Ek
64.Bk -words
65.Op Fl h Ar header
66.Ek
67.Bk -words
68.Oo
69.Op Fl i
70.Op Ar char
71.Op Ar gap
72.Oc
73.Ek
74.Bk -words
75.Op Fl l Ar lines
76.Ek
77.Bk -words
78.Op Fl o Ar offset
79.Ek
80.Bk -words
81.Oo
82.Op Fl s
83.Op Ar char
84.Oc
85.Ek
86.Bk -words
87.Oo
88.Op Fl n
89.Op Ar char
90.Op Ar width
91.Oc
92.Ek
93.Bk -words
94.Op Fl w Ar width
95.Ek
96.Op -
97.Op Ar file ...
98.Sh DESCRIPTION
99The
100.Nm
101utility is a printing and pagination filter for text files.
102When multiple input files are specified, each is read, formatted,
103and written to standard output.
104By default, the input is separated into 66-line pages, each with
105.sp
106.in +2
107.ti -2
108\(bu A 5-line header with the page number, date, time, and
109the pathname of the file.
110.sp
111.ti -2
112\(bu A 5-line trailer consisting of blank lines.
113.in -2
114.Pp
115If standard output is associated with a terminal,
116diagnostic messages are suppressed until the
117.Nm
118utility has completed processing.
119.Pp
120When multiple column output is specified,
121text columns are of equal width.
122By default text columns are separated by at least one
123.Em <blank> .
124Input lines that do not fit into a text column are truncated.
125Lines are not truncated under single column output.
126.Sh OPTIONS
127.Pp
128In the following option descriptions, column, lines, offset, page, and
129width are positive decimal integers and gap is a nonnegative decimal integer.
130.Bl -tag -width 4n
131.It Ar \&+page
132Begin output at page number
133.Ar page
134of the formatted input.
135.It Fl Ar column
136Produce output that is
137.Ar columns
138wide (default is 1) that is written vertically
139down each column in the order in which the text
140is received from the input file.
141The options
142.Fl e
143and
144.Fl i
145are assumed.
146This option should not be used with
147.Fl m .
148When used with
149.Fl t ,
150the minimum number of lines is used to display the output.
151.It Fl a
152Modify the effect of the
153.Fl column
154option so that the columns are filled across the page in a round-robin order
155(e.g., when column is 2, the first input line heads column
1561, the second heads column 2, the third is the second line
157in column 1, etc.).
158This option requires the use of the
159.Fl column
160option.
161.It Fl d
162Produce output that is double spaced.
163An extra
164.Em <newline>
165character is output following every
166.Em <newline>
167found in the input.
168.It Fl e Ar \&[char\&]\&[gap\&]
169Expand each input
170.Em <tab>
171to the next greater column
172position specified by the formula
173.Ar n*gap+1 ,
174where
175.Em n
176is an integer > 0.
177If
178.Ar gap
179is zero or is omitted the default is 8.
180All
181.Em <tab>
182characters in the input are expanded into the appropriate
183number of
184.Em <space>s .
185If any nondigit character,
186.Ar char ,
187is specified, it is used as the input tab character.
188.It Fl F
189Use a
190.Em <form-feed>
191character for new pages,
192instead of the default behavior that uses a
193sequence of
194.Em <newline>
195characters.
196.It Fl h Ar header
197Use the string
198.Ar header
199to replace the
200.Ar file name
201in the header line.
202.It Fl i Ar \&[char\&]\&[gap\&]
203In output, replace multiple
204.Em <space>s
205with
206.Em <tab>s
207whenever two or more
208adjacent
209.Em <space>s
210reach column positions
211.Ar gap+1 ,
212.Ar 2*gap+1 ,
213etc.
214If
215.Ar gap
216is zero or omitted, default
217.Em <tab>
218settings at every eighth column position
219is used.
220If any nondigit character,
221.Ar char ,
222is specified, it is used as the output
223.Em <tab>
224character.
225.It Fl L Ar locale
226Use
227.Ar locale
228specified as argument instead of one found in environment.
229Use "C" to reset locale to default.
230.It Fl l Ar lines
231Override the 66 line default and reset the page length to
232.Ar lines .
233If
234.Ar lines
235is not greater than the sum of both the header and trailer
236depths (in lines), the
237.Nm
238utility suppresses output of both the header and trailer, as if the
239.Fl t
240option were in effect.
241.It Fl m
242Merge the contents of multiple files.
243One line from each file specified by a file operand is
244written side by side into text columns of equal fixed widths, in
245terms of the number of column positions.
246The number of text columns depends on the number of
247file operands successfully opened.
248The maximum number of files merged depends on page width and the
249per process open file limit.
250The options
251.Fl e
252and
253.Fl i
254are assumed.
255.It Fl n Ar \&[char\&]\&[width\&]
256Provide
257.Ar width
258digit line numbering.
259The default for
260.Ar width ,
261if not specified, is 5.
262The number occupies the first
263.Ar width
264column positions of each text column or each line of
265.Fl m
266output.
267If
268.Ar char
269(any nondigit character) is given, it is appended to the line number to
270separate it from whatever follows.
271The default for
272.Ar char
273is a
274.Em <tab> .
275Line numbers longer than
276.Ar width
277columns are truncated.
278.It Fl o Ar offset
279Each line of output is preceded by
280.Ar offset
281.Em <spaces>s .
282If the
283.FL o
284option is not specified, the default is zero.
285The space taken is in addition to the output line width.
286.It Fl r
287Write no diagnostic reports on failure to open a file.
288.It Fl s Ar char
289Separate text columns by the single character
290.Ar char
291instead of by the appropriate number of
292.Em <space>s
293(default for
294.Ar char
295is the
296.Em <tab>
297character).
298.It Fl t
299Print neither the five-line identifying
300header nor the five-line trailer usually supplied for each page.
301Quit printing after the last line of each file without spacing to the
302end of the page.
303.It Fl w Ar width
304Set the width of the line to
305.Ar width
306column positions for multiple text-column output only.
307If the
308.Fl w
309option is not specified and the
310.Fl s
311option is not specified, the default width is 72.
312If the
313.Fl w
314option is not specified and the
315.Fl s
316option is specified, the default width is 512.
317.It Ar file
318A pathname of a file to be printed.
319If no
320.Ar file
321operands are specified, or if a
322.Ar file
323operand is
324.Sq Fl ,
325the standard input is used.
326The standard input is used only if no
327.Ar file
328operands are specified, or if a
329.Ar file
330operand is
331.Sq Fl .
332.El
333.Pp
334The
335.Fl s
336option does not allow the option letter to be separated from its
337argument, and the options
338.Fl e ,
339.Fl i ,
340and
341.Fl n
342require that both arguments, if present, not be separated from the option
343letter.
344.Sh ERRORS
345.Pp
346If
347.Nm
348receives an interrupt while printing to a terminal, it
349flushes all accumulated error messages to the screen before
350terminating.
351.Pp
352The
353.Nm
354utility exits 0 on success, and 1 if an error occurs.
355.Pp
356Error messages are written to standard error during the printing
357process (if output is redirected) or after all successful
358file printing is complete (when printing to a terminal).
359.Sh SEE ALSO
360.Xr cat 1 ,
361.Xr more 1
362.Sh STANDARDS
363The
364.Nm
365utility is
366.St -p1003.2
367compatible.
368.Sh HISTORY
369A
370.Nm
371command appeared in
372.At v1 .
373