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