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