xref: /freebsd/usr.bin/pr/pr.1 (revision 5129159789cc9d7bc514e4546b88e3427695002d)
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. An extra
163.Em <newline>
164character is output following every
165.Em <newline>
166found in the input.
167.It Fl e Ar \&[char\&]\&[gap\&]
168Expand each input
169.Em <tab>
170to the next greater column
171position specified by the formula
172.Ar n*gap+1 ,
173where
174.Em n
175is an integer > 0.
176If
177.Ar gap
178is zero or is omitted the default is 8.
179All
180.Em <tab>
181characters in the input are expanded into the appropriate
182number of
183.Em <space>s .
184If any nondigit character,
185.Ar char ,
186is specified, it is used as the input tab character.
187.It Fl F
188Use a
189.Em <form-feed>
190character for new pages,
191instead of the default behavior that uses a
192sequence of
193.Em <newline>
194characters.
195.It Fl h Ar header
196Use the string
197.Ar header
198to replace the
199.Ar file name
200in the header line.
201.It Fl i Ar \&[char\&]\&[gap\&]
202In output, replace multiple
203.Em <space>s
204with
205.Em <tab>s
206whenever two or more
207adjacent
208.Em <space>s
209reach column positions
210.Ar gap+1 ,
211.Ar 2*gap+1 ,
212etc.
213If
214.Ar gap
215is zero or omitted, default
216.Em <tab>
217settings at every eighth column position
218is used.
219If any nondigit character,
220.Ar char ,
221is specified, it is used as the output
222.Em <tab>
223character.
224.It Fl L Ar locale
225Use
226.Ar locale
227specified as argument instead of one found in environment.
228Use "C" to reset locale to default.
229.It Fl l Ar lines
230Override the 66 line default and reset the page length to
231.Ar lines .
232If
233.Ar lines
234is not greater than the sum of both the header and trailer
235depths (in lines), the
236.Nm
237utility suppresses output of both the header and trailer, as if the
238.Fl t
239option were in effect.
240.It Fl m
241Merge the contents of multiple files.
242One line from each file specified by a file operand is
243written side by side into text columns of equal fixed widths, in
244terms of the number of column positions.
245The number of text columns depends on the number of
246file operands successfully opened.
247The maximum number of files merged depends on page width and the
248per process open file limit.
249The options
250.Fl e
251and
252.Fl i
253are assumed.
254.It Fl n Ar \&[char\&]\&[width\&]
255Provide
256.Ar width
257digit line numbering.
258The default for
259.Ar width ,
260if not specified, is 5.
261The number occupies the first
262.Ar width
263column positions of each text column or each line of
264.Fl m
265output.
266If
267.Ar char
268(any nondigit character) is given, it is appended to the line number to
269separate it from whatever follows. The 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