1pr(1) User Commands pr(1)
2
3
4
6 pr - print files
7
9 /usr/bin/pr [+ page] [-column] [-adFmrt] [-e [char] [gap]]
10 [-h header] [-i [char] [gap]] [-l lines]
11 [-n [char] [width]] [-o offset] [-s [char]]
12 [-w width] [-fp] [file]...
13
14
15 /usr/xpg4/bin/pr [+ page] [-column | -c column] [-adFmrt]
16 [-e [char] [gap]] [-h header] [-i [char] [gap]]
17 [-l lines] [-n [char] [width]] [-o offset]
18 [-s [char]] [-w width] [-fp] [file]...
19
20
22 The pr utility is a printing and pagination filter. If multiple input
23 files are specified, each is read, formatted, and written to standard
24 output. By default, the input is separated into 66-line pages, each
25 with:
26
27 o a 5-line header that includes the page number, date, time
28 and the path name of the file
29
30 o a 5-line trailer consisting of blank lines
31
32
33 If standard output is associated with a terminal, diagnostic messages
34 will be deferred until the pr utility has completed processing.
35
36
37 When options specifying multi-column output are specified, output text
38 columns will be of equal width; input lines that do not fit into a text
39 column will be truncated. By default, text columns are separated with
40 at least one blank character.
41
43 The following options are supported. In the following option descrip‐
44 tions, column, lines, offset, page, and width are positive decimal
45 integers; gap is a non-negative decimal integer. Some of the option-
46 arguments are optional, and some of the option-arguments cannot be
47 specified as separate arguments from the preceding option letter. In
48 particular, the -s option does not allow the option letter to be sepa‐
49 rated from its argument, and the options -e, -i, and -n require that
50 both arguments, if present, not be separated from the option letter.
51
52
53 The following options are supported for both /usr/bin/pr and
54 /usr/xpg4/bin/pr:
55
56 +page Begins output at page number page of the
57 formatted input.
58
59
60 -column Produces multi-column output that is
61 arranged in column columns (default is 1)
62 and is written down each column in the
63 order in which the text is received from
64 the input file. This option should not be
65 used with -m. The -e and -i options will
66 be assumed for multiple text-column out‐
67 put. Whether or not text columns are pro‐
68 duced with identical vertical lengths is
69 unspecified, but a text column will never
70 exceed the length of the page (see the -l
71 option). When used with -t, use the mini‐
72 mum number of lines to write the output.
73
74
75 -a Modifies the effect of the -column option
76 so that the columns are filled across the
77 page in a round-robin order (for example,
78 when column is 2, the first input line
79 heads column 1, the second heads column 2,
80 the third is the second line in column 1,
81 and so forth).
82
83
84 -d Produces output that is double-spaced;
85 append an extra NEWLINE character follow‐
86 ing every NEWLINE character found in the
87 input.
88
89
90 -e[char][gap] Expands each input TAB character to the
91 next greater column position specified by
92 the formula n *gap+1, where n is an inte‐
93 ger >0. If gap is 0 or is omitted, it
94 defaults to 8. All TAB characters in the
95 input will be expanded into the appropri‐
96 ate number of SPACE characters. If any
97 non-digit character, char, is specified,
98 it will be used as the input tab charac‐
99 ter.
100
101
102 -f Uses a FORMFEED character for new pages,
103 instead of the default behavior that uses
104 a sequence of NEWLINE characters. Pauses
105 before beginning the first page if the
106 standard output is associated with a ter‐
107 minal.
108
109
110 -h header Uses the string header to replace the con‐
111 tents of the file operand in the page
112 header.
113
114
115 -l lines Overrides the 66-line default and reset
116 the page length to lines. If lines is not
117 greater than the sum of both the header
118 and trailer depths (in lines), pr will
119 suppress both the header and trailer, as
120 if the -t option were in effect.
121
122
123 -m Merges files. Standard output will be for‐
124 matted so pr writes one line from each
125 file specified by file, side by side into
126 text columns of equal fixed widths, in
127 terms of the number of column positions.
128 Implementations support merging of at
129 least nine files.
130
131
132 -n[char][width] Provides width-digit line numbering
133 (default for width is 5). The number will
134 occupy the first width column positions of
135 each text column of default output or each
136 line of -m output. If char (any non-digit
137 character) is given, it will be appended
138 to the line number to separate it from
139 whatever follows (default for char is a
140 TAB character).
141
142
143 -o offset Each line of output will be preceded by
144 offset <space>s. If the -o option is not
145 specified, the default offset is 0. The
146 space taken will be in addition to the
147 output line width (see -w option below).
148
149
150 -p Pauses before beginning each page if the
151 standard output is directed to a terminal
152 (pr will write an ALERT character to stan‐
153 dard error and wait for a carriage-return
154 character to be read on /dev/tty).
155
156
157 -r Writes no diagnostic reports on failure to
158 open files.
159
160
161 -s [char] Separates text columns by the single char‐
162 acter char instead of by the appropriate
163 number of SPACE characters (default for
164 char is the TAB character).
165
166
167 -t Writes neither the five-line identifying
168 header nor the five-line trailer usually
169 supplied for each page. Quits writing
170 after the last line of each file without
171 spacing to the end of the page.
172
173
174 -w width Sets the width of the line to width column
175 positions for multiple text-column output
176 only. If the -w option is not specified
177 and the -s option is not specified, the
178 default width is 72. If the -w option is
179 not specified and the -s option is speci‐
180 fied, the default width is 512.
181
182 For single column output, input lines will
183 not be truncated.
184
185
186 /usr/bin/pr
187 The following options are supported for /usr/bin/pr only:
188
189 -F Folds the lines of the input file. When used
190 in multi-column mode (with the -a or -m
191 options), lines will be folded to fit the
192 current column's width. Otherwise, they will
193 be folded to fit the current line width (80
194 columns).
195
196
197 -i[char][gap] In output, replaces SPACE characters with
198 TAB characters wherever one or more adjacent
199 SPACE characters reach column positions
200 gap+1, 2*gap+1, 3*gap+1, and so forth. If
201 gap is 0 or is omitted, default TAB settings
202 at every eighth column position are assumed.
203 If any non-digit character, char, is speci‐
204 fied, it will be used as the output TAB
205 character.
206
207
208 /usr/xpg4/bin/pr
209 The following options are supported for /usr/xpg4/bin/pr only:
210
211 -F Uses a FORMFEED character for new pages,
212 instead of the default behavior that uses a
213 sequence of NEWLINE characters.
214
215
216 -i[char][gap] In output, replaces multiple SPACE charac‐
217 ters with TAB characters wherever two or
218 more adjacent SPACE characters reach column
219 positions gap+1, 2*gap+1, 3*gap+1, and so
220 forth. If gap is 0 or is omitted, default
221 TAB settings at every eighth column position
222 are assumed. If any non-digit character,
223 char, is specified, it will be used as the
224 output TAB character.
225
226
228 The following operand is supported:
229
230 file A path name of a file to be written. If no file operands are
231 specified, or if a file operand is −, the standard input will
232 be used.
233
234
236 Example 1 Printing a numbered list of all files in the current direc‐
237 tory
238
239 example% ls -a | pr -n -h "Files in $(pwd)."
240
241
242
243 Example 2 Printing files in columns
244
245
246 This example prints file1 and file2 as a double-spaced, three-column
247 listing headed by file list:
248
249
250 example% pr -3d -h "file list" file1 file2
251
252
253
254 Example 3 Writing files with expanded column tabs
255
256
257 The following example writes file1 on file2, expanding tabs to columns
258 10, 19, 28, ...
259
260
261 example% pr -e9 -t <file1 >file2
262
263
264
266 See environ(5) for descriptions of the following environment variables
267 that affect the execution of pr: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
268 LC_TIME, TZ, and NLSPATH.
269
271 The following exit values are returned:
272
273 0 Successful completion.
274
275
276 >0 An error occurred.
277
278
280 See attributes(5) for descriptions of the following attributes:
281
282 /usr/bin/pr
283 ┌─────────────────────────────┬─────────────────────────────┐
284 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
285 ├─────────────────────────────┼─────────────────────────────┤
286 │Availability │SUNWcsu │
287 ├─────────────────────────────┼─────────────────────────────┤
288 │CSI │Enabled │
289 └─────────────────────────────┴─────────────────────────────┘
290
291 /usr/xpg4/bin/pr
292 ┌─────────────────────────────┬─────────────────────────────┐
293 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
294 ├─────────────────────────────┼─────────────────────────────┤
295 │Availability │SUNWxcu4 │
296 ├─────────────────────────────┼─────────────────────────────┤
297 │CSI │Enabled │
298 ├─────────────────────────────┼─────────────────────────────┤
299 │Interface Stability │Committed │
300 ├─────────────────────────────┼─────────────────────────────┤
301 │Standard │See standards(5). │
302 └─────────────────────────────┴─────────────────────────────┘
303
305 expand(1), lp(1), attributes(5), environ(5), standards(5)
306
307
308
309SunOS 5.11 18 Mar 1997 pr(1)