summaryrefslogtreecommitdiff
path: root/usr/src/man/man1/pr.1
blob: 69b052df157c1bcfbb5d822e1bddbb3f04b40bbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
.\"
.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
.\" permission to reproduce portions of its copyrighted documentation.
.\" Original documentation from The Open Group can be obtained online at
.\" http://www.opengroup.org/bookstore/.
.\"
.\" The Institute of Electrical and Electronics Engineers and The Open
.\" Group, have given us permission to reprint portions of their
.\" documentation.
.\"
.\" In the following statement, the phrase ``this text'' refers to portions
.\" of the system documentation.
.\"
.\" Portions of this text are reprinted and reproduced in electronic form
.\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
.\" Standard for Information Technology -- Portable Operating System
.\" Interface (POSIX), The Open Group Base Specifications Issue 6,
.\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
.\" Engineers, Inc and The Open Group.  In the event of any discrepancy
.\" between these versions and the original IEEE and The Open Group
.\" Standard, the original IEEE and The Open Group Standard is the referee
.\" document.  The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
.\" This notice shall appear on any product containing this material.
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\"
.\" Copyright 1989 AT&T
.\" Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
.\" Portions Copyright (c) 1995, Sun Microsystems, Inc.  All Rights Reserved
.\"
.TH PR 1 "Mar 18, 1997"
.SH NAME
pr \- print files
.SH SYNOPSIS
.LP
.nf
\fB/usr/bin/pr\fR [+ \fIpage\fR] [\fB-column\fR] [\fB-adFmrt\fR] [\fB-e\fR [\fIchar\fR] [\fIgap\fR]]
     [\fB-h\fR \fIheader\fR] [\fB-i\fR [\fIchar\fR] [\fIgap\fR]] [\fB-l\fR \fIlines\fR]
     [\fB-n\fR [\fIchar\fR] [\fIwidth\fR]] [\fB-o\fR \fIoffset\fR] [\fB-s\fR [\fIchar\fR]]
     [\fB-w\fR \fIwidth\fR] [\fB-fp\fR] [\fIfile\fR]...
.fi

.LP
.nf
\fB/usr/xpg4/bin/pr\fR [+ \fIpage\fR] [\fB-column\fR | \fB-c\fR \fIcolumn\fR] [\fB-adFmrt\fR]
     [\fB-e\fR [\fIchar\fR] [\fIgap\fR]] [\fB-h\fR \fIheader\fR] [\fB-i\fR [\fIchar\fR] [\fIgap\fR]]
     [\fB-l\fR \fIlines\fR] [\fB-n\fR [\fIchar\fR] [\fIwidth\fR]] [\fB-o\fR \fIoffset\fR]
     [\fB-s\fR [\fIchar\fR]] [\fB-w\fR \fIwidth\fR] [\fB-fp\fR] [\fIfile\fR]...
.fi

.SH DESCRIPTION
.sp
.LP
The \fBpr\fR utility is a printing and pagination filter. If multiple input
files are specified, each is read, formatted, and written to standard output.
By default, the input is separated into 66-line pages, each with:
.RS +4
.TP
.ie t \(bu
.el o
a 5-line header that includes the page number, date, time and the path name of
the file
.RE
.RS +4
.TP
.ie t \(bu
.el o
a 5-line trailer consisting of blank lines
.RE
.sp
.LP
If standard output is associated with a terminal, diagnostic messages will be
deferred until the \fBpr\fR utility has completed processing.
.sp
.LP
When options specifying multi-column output are specified, output text columns
will be of equal width; input lines that do not fit into a text column will be
truncated. By default, text columns are separated with at least one blank
character.
.SH OPTIONS
.sp
.LP
The following options are supported. In the following option descriptions,
\fIcolumn\fR, \fIlines\fR, \fIoffset\fR, \fIpage\fR, and \fIwidth\fR are
positive decimal integers; \fIgap\fR is a non-negative decimal integer. Some of
the option-arguments are optional, and some of the option-arguments cannot be
specified as separate arguments from the preceding option letter. In
particular, the \fB-s\fR option does not allow the option letter to be
separated from its argument, and the options \fB-e\fR, \fB-i\fR, and \fB-n\fR
require that both arguments, if present, not be separated from the option
letter.
.sp
.LP
The following options are supported for both \fB/usr/bin/pr\fR and
\fB/usr/xpg4/bin/pr\fR:
.sp
.ne 2
.na
\fB\fB+\fR\fIpage\fR\fR
.ad
.RS 29n
Begins output at page number \fIpage\fR of the formatted input.
.RE

.sp
.ne 2
.na
\fB\fB-\fR\fIcolumn\fR\fR
.ad
.RS 29n
Produces multi-column output that is arranged in \fIcolumn\fR columns (default
is \fB1\fR) and is written down each column in the order in which the text is
received from the input file. This option should not be used with \fB-m\fR. The
\fB-e\fR and \fB-i\fR options will be assumed for multiple text-column output.
Whether or not text columns are produced with identical vertical lengths is
unspecified, but a text column will never exceed the length of the page (see
the \fB-l\fR option). When used with \fB-t\fR, use the minimum number of lines
to write the output.
.RE

.sp
.ne 2
.na
\fB\fB-a\fR\fR
.ad
.RS 29n
Modifies the effect of the \fB-\fR\fIcolumn\fR option so that the columns are
filled across the page in a round-robin order (for example, when \fIcolumn\fR
is 2, the first input line heads column 1, the second heads column 2, the third
is the second line in column 1, and so forth).
.RE

.sp
.ne 2
.na
\fB\fB-d\fR\fR
.ad
.RS 29n
Produces output that is double-spaced; append an extra \fBNEWLINE\fR character
following every \fBNEWLINE\fR character found in the input.
.RE

.sp
.ne 2
.na
\fB\fB\fR\fB-e\fR\fB\|[\|\fR\fIchar\fR\fB\|][\|\fR\fIgap\fR\fB\|]\fR\fR
.ad
.RS 29n
Expands each input \fBTAB\fR character to the next greater column position
specified by the formula \fIn\fR \fI*gap+1\fR, where \fIn\fR is an integer
\fB>0\fR. If \fIgap\fR is \fB0\fR or is omitted, it defaults to \fB8\fR. All
\fBTAB\fR characters in the input will be expanded into the appropriate number
of \fBSPACE\fR characters.  If any non-digit character, \fIchar\fR, is
specified, it will be used as the input tab character.
.RE

.sp
.ne 2
.na
\fB\fB-f\fR\fR
.ad
.RS 29n
Uses a \fBFORMFEED\fR character for new pages, instead of the default behavior
that uses a sequence of \fBNEWLINE\fR characters. Pauses before beginning the
first page if the standard output is associated with a terminal.
.RE

.sp
.ne 2
.na
\fB\fB-h\fR \fIheader\fR\fR
.ad
.RS 29n
Uses the string \fIheader\fR to replace the contents of the \fIfile\fR operand
in the page header.
.RE

.sp
.ne 2
.na
\fB\fB-l\fR \fIlines\fR\fR
.ad
.RS 29n
Overrides the 66-line default and reset the page length to \fIlines\fR. If
\fIlines\fR is not greater than the sum of both the header and trailer depths
(in lines), \fBpr\fR will suppress both the header and trailer, as if the
\fB-t\fR option were in effect.
.RE

.sp
.ne 2
.na
\fB\fB-m\fR\fR
.ad
.RS 29n
Merges files. Standard output will be formatted so \fBpr\fR writes one line
from each file specified by \fIfile\fR, side by side into text columns of equal
fixed widths, in terms of the number of column positions. Implementations
support merging of at least nine \fIfile\fRs.
.RE

.sp
.ne 2
.na
\fB\fB-n\|[\|\fR\fIchar\fR\fB\|][\|\fR\fIwidth\fR\fB\|]\fR\fR
.ad
.RS 29n
Provides \fIwidth\fR-digit line numbering (default for \fIwidth\fR is \fB5\fR).
The number will occupy the first \fIwidth\fR column positions of each text
column of default output or each line of \fB-m\fR output. If \fIchar\fR (any
non-digit character) is given, it will be appended to the line number to
separate it from whatever follows (default for \fIchar\fR is a \fBTAB\fR
character).
.RE

.sp
.ne 2
.na
\fB\fB-o\fR \fIoffset\fR\fR
.ad
.RS 29n
Each line of output will be preceded by offset <space>s. If the \fB-o\fR option
is not specified, the default offset is \fB0\fR. The space taken will be in
addition to the output line width (see \fB-w\fR option below).
.RE

.sp
.ne 2
.na
\fB\fB-p\fR\fR
.ad
.RS 29n
Pauses before beginning each page if the standard output is directed to a
terminal (\fBpr\fR will write an \fBALERT\fR character to standard error and
wait for a carriage-return character to be read on \fB/dev/tty\fR).
.RE

.sp
.ne 2
.na
\fB\fB-r\fR\fR
.ad
.RS 29n
Writes no diagnostic reports on failure to open files.
.RE

.sp
.ne 2
.na
\fB\fB-s\fR \fB[\fR\fIchar\fR\fB]\fR\fR
.ad
.RS 29n
Separates text columns by the single character \fIchar\fR instead of by the
appropriate number of \fBSPACE\fR characters (default for \fIchar\fR is the
\fBTAB\fR character).
.RE

.sp
.ne 2
.na
\fB\fB-t\fR\fR
.ad
.RS 29n
Writes neither the five-line identifying header nor the five-line trailer
usually supplied for each page. Quits writing after the last line of each file
without spacing to the end of the page.
.RE

.sp
.ne 2
.na
\fB\fB-w\fR \fIwidth\fR\fR
.ad
.RS 29n
Sets the width of the line to \fIwidth\fR column positions for multiple
text-column output only. If the \fB-w\fR option is not specified and the
\fB-s\fR option is not specified, the default width is \fB72\fR. If the
\fB-w\fR option is not specified and the \fB-s\fR option is specified, the
default width is \fB512\fR.
.sp
For single column output, input lines will not be truncated.
.RE

.SS "/usr/bin/pr"
.sp
.LP
The following options are supported for \fB/usr/bin/pr\fR only:
.sp
.ne 2
.na
\fB\fB-F\fR\fR
.ad
.RS 27n
Folds the lines of the input file. When used in multi-column mode (with the
\fB-a\fR or \fB-m\fR options), lines will be folded to fit the current column's
width. Otherwise, they will be folded to fit the current line width (80
columns).
.RE

.sp
.ne 2
.na
\fB\fB\fR\fB-i\fR\fB\|[\|\fR\fIchar\fR\fB\|][\|\fR\fIgap\fR\fB\|]\fR\fR
.ad
.RS 27n
In output, replaces \fBSPACE\fR characters with \fBTAB\fR characters wherever
one or more adjacent \fBSPACE\fR characters reach column positions \fIgap+1\fR,
\fI2*gap+1\fR, \fI3*gap+1\fR, and so forth. If \fIgap\fR is \fB0\fR or is
omitted, default \fBTAB\fR settings at every eighth column position are
assumed. If any non-digit character, \fIchar\fR, is specified, it will be used
as the output \fBTAB\fR character.
.RE

.SS "/usr/xpg4/bin/pr"
.sp
.LP
The following options are supported for \fB/usr/xpg4/bin/pr\fR only:
.sp
.ne 2
.na
\fB\fB-F\fR\fR
.ad
.RS 27n
Uses a \fBFORMFEED\fR character for new pages, instead of the default behavior
that uses a sequence of \fBNEWLINE\fR characters.
.RE

.sp
.ne 2
.na
\fB\fB\fR\fB-i\fR\fB\|[\|\fR\fIchar\fR\fB\|][\|\fR\fIgap\fR\fB\|]\fR\fR
.ad
.RS 27n
In output, replaces multiple \fBSPACE\fR characters with \fBTAB\fR characters
wherever two or more adjacent \fBSPACE\fR characters reach column positions
\fIgap+1\fR, \fI2*gap+1\fR, \fI3*gap+1\fR, and so forth. If \fIgap\fR is
\fB0\fR or is omitted, default \fBTAB\fR settings at every eighth column
position are assumed. If any non-digit character, \fIchar\fR, is specified, it
will be used as the output \fBTAB\fR character.
.RE

.SH OPERANDS
.sp
.LP
The following operand is supported:
.sp
.ne 2
.na
\fB\fIfile\fR\fR
.ad
.RS 8n
A path name of a file to be written. If no \fIfile\fR operands are specified,
or if a \fIfile\fR operand is \fB\(mi\fR, the standard input will be used.
.RE

.SH EXAMPLES
.LP
\fBExample 1 \fRPrinting a numbered list of all files in the current directory
.sp
.in +2
.nf
example% \fBls -a | pr -n -h "Files in $(pwd)."\fR
.fi
.in -2
.sp

.LP
\fBExample 2 \fRPrinting files in columns
.sp
.LP
This example prints \fBfile1\fR and \fBfile2\fR as a double-spaced,
three-column listing headed by \fBfile list\fR:

.sp
.in +2
.nf
example% \fBpr -3d -h "file list" file1 file2\fR
.fi
.in -2
.sp

.LP
\fBExample 3 \fRWriting files with expanded column tabs
.sp
.LP
The following example writes \fBfile1\fR on \fBfile2\fR, expanding tabs to
columns \fB10\fR, \fB19\fR, \fB28\fR, ...

.sp
.in +2
.nf
example% \fBpr -e9 -t <file1 >file2\fR
.fi
.in -2
.sp

.SH ENVIRONMENT VARIABLES
.sp
.LP
See \fBenviron\fR(7) for descriptions of the following environment variables
that affect the execution of \fBpr\fR: \fBLANG\fR, \fBLC_ALL\fR,
\fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, \fBLC_TIME\fR, \fBTZ\fR, and \fBNLSPATH\fR.
.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 6n
Successful completion.
.RE

.sp
.ne 2
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
An error occurred.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.SS "/usr/bin/pr"
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
CSI	Enabled
.TE

.SS "/usr/xpg4/bin/pr"
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
CSI	Enabled
_
Interface Stability	Committed
_
Standard	See \fBstandards\fR(7).
.TE

.SH SEE ALSO
.sp
.LP
.BR expand (1),
.BR lp (1),
.BR attributes (7),
.BR environ (7),
.BR standards (7)