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