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