1.\" $NetBSD: pr.1,v 1.5 1997/06/26 20:23:47 kleink Exp $ 2.\" 3.\" Copyright (c) 1991 Keith Muller. 4.\" Copyright (c) 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" This code is derived from software contributed to Berkeley by 8.\" Keith Muller of the University of California, San Diego. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 3. All advertising materials mentioning features or use of this software 19.\" must display the following acknowledgement: 20.\" This product includes software developed by the University of 21.\" California, Berkeley and its contributors. 22.\" 4. Neither the name of the University nor the names of its contributors 23.\" may be used to endorse or promote products derived from this software 24.\" without specific prior written permission. 25.\" 26.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36.\" SUCH DAMAGE. 37.\" 38.\" from: @(#)pr.1 8.1 (Berkeley) 6/6/93 39.\" $NetBSD: pr.1,v 1.5 1997/06/26 20:23:47 kleink Exp $ 40.\" 41.Dd June 6, 1993 42.Dt PR 1 43.Os BSD 4.4 44.Sh NAME 45.Nm pr 46.Nd print files 47.Sh SYNOPSIS 48.Nm pr 49.Bk -words 50.Op Ar \&+page 51.Ek 52.Bk -words 53.Op Fl Ar column 54.Ek 55.Op Fl adFmrt 56.Bk -words 57.Oo 58.Op Fl e 59.Op Ar char 60.Op Ar gap 61.Oc 62.Ek 63.Bk -words 64.Op Fl h Ar header 65.Ek 66.Bk -words 67.Oo 68.Op Fl i 69.Op Ar char 70.Op Ar gap 71.Oc 72.Ek 73.Bk -words 74.Op Fl l Ar lines 75.Ek 76.Bk -words 77.Op Fl o Ar offset 78.Ek 79.Bk -words 80.Oo 81.Op Fl s 82.Op Ar char 83.Oc 84.Ek 85.Bk -words 86.Oo 87.Op Fl n 88.Op Ar char 89.Op Ar width 90.Oc 91.Ek 92.Bk -words 93.Op Fl w Ar width 94.Ek 95.Op - 96.Op Ar file ... 97.Sh DESCRIPTION 98The 99.Nm pr 100utility is a printing and pagination filter for text files. 101When multiple input files are specified, each is read, formatted, 102and written to standard output. 103By default, the input is separated into 66-line pages, each with 104.sp 105.in +2 106.ti -2 107\(bu A 5-line header with the page number, date, time, and 108the pathname of the file. 109.sp 110.ti -2 111\(bu A 5-line trailer consisting of blank lines. 112.in -2 113.Pp 114If standard output is associated with a terminal, 115diagnostic messages are suppressed until the 116.Nm pr 117utility has completed processing. 118.Pp 119When multiple column output is specified, 120text columns are of equal width. 121By default text columns are separated by at least one 122.Em <blank>. 123Input lines that do not fit into a text column are truncated. 124Lines are not truncated under single column output. 125.Sh OPTIONS 126.Pp 127In the following option descriptions, column, lines, offset, page, and 128width are positive decimal integers and gap is a nonnegative decimal integer. 129.Bl -tag -width 4n 130.It Ar \&+page 131Begin output at page number 132.Ar page 133of the formatted input. 134.It Fl Ar column 135Produce output that is 136.Ar columns 137wide (default is 1) that is written vertically 138down each column in the order in which the text 139is received from the input file. 140The options 141.Fl e 142and 143.Fl i 144are assumed. 145This option should not be used with 146.Fl m . 147When used with 148.Fl t , 149the minimum number of lines is used to display the output. 150.It Fl a 151Modify the effect of the 152.Fl column 153option so that the columns are filled across the page in a round-robin order 154(e.g., when column is 2, the first input line heads column 1551, the second heads column 2, the third is the second line 156in column 1, etc.). 157This option requires the use of the 158.Fl column 159option. 160.It Fl d 161Produce output that is double spaced. An extra 162.Em <newline> 163character is output following every <newline> found in the input. 164.It Fl e Ar \&[char\&]\&[gap\&] 165Expand each input <tab> to the next greater column 166position specified by the formula 167.Ar n*gap+1 , 168where 169.Em n 170is an integer > 0. 171If 172.Ar gap 173is zero or is omitted the default is 8. 174All 175.Em <tab> 176characters in the input are expanded into the appropriate 177number of 178.Em <space>s . 179If any nondigit character, 180.Ar char , 181is specified, it is used as the input tab character. 182.It Fl F 183Use a 184.Em <form-feed> 185character for new pages, 186instead of the default behavior that uses a 187sequence of 188.Em <newline> 189characters. 190.It Fl h Ar header 191Use the string 192.Ar header 193to replace the 194.Ar file name 195in the header line. 196.It Fl i Ar \&[char\&]\&[gap\&] 197In output, replace multiple <space>s with <tab>s whenever two or more 198adjacent <space>s reach column positions 199.Ar gap+1 , 200.Ar 2*gap+1 , 201etc. 202If 203.Ar gap 204is zero or omitted, default 205.Em <tab> 206settings at every eighth column position 207is used. 208If any nondigit character, 209.Ar char , 210is specified, it is used as the output 211.Em <tab> 212character. 213.It Fl l Ar lines 214Override the 66 line default and reset the page length to 215.Ar lines. 216If 217.Ar lines 218is not greater than the sum of both the header and trailer 219depths (in lines), the 220.Nm pr 221utility suppresses output of both the header and trailer, as if the 222.Fl t 223option were in effect. 224.It Fl m 225Merge the contents of multiple files. 226One line from each file specified by a file operand is 227written side by side into text columns of equal fixed widths, in 228terms of the number of column positions. 229The number of text columns depends on the number of 230file operands successfully opened. 231The maximum number of files merged depends on page width and the 232per process open file limit. 233The options 234.Fl e 235and 236.Fl i 237are assumed. 238.It Fl n Ar \&[char\&]\&[width\&] 239Provide 240.Ar width 241digit line numbering. 242The default for 243.Ar width , 244if not specified, is 5. 245The number occupies the first 246.Ar width 247column positions of each text column or each line of 248.Fl m 249output. 250If 251.Ar char 252(any nondigit character) is given, it is appended to the line number to 253separate it from whatever follows. The default for 254.Ar char 255is a 256.Em <tab> . 257Line numbers longer than 258.Ar width 259columns are truncated. 260.It Fl o Ar offset 261Each line of output is preceeded by 262.Ar offset 263.Em <spaces>s . 264If the 265.Fl o 266option is not specified, the default is zero. 267The space taken is in addition to the output line width. 268.It Fl r 269Write no diagnostic reports on failure to open a file. 270.It Fl s Ar char 271Separate text columns by the single character 272.Ar char 273instead of by the appropriate number of 274.Em <space>s 275(default for 276.Ar char 277is the 278.Em <tab> 279character). 280.It Fl t 281Print neither the five-line identifying 282header nor the five-line trailer usually supplied for each page. 283Quit printing after the last line of each file without spacing to the 284end of the page. 285.It Fl w Ar width 286Set the width of the line to 287.Ar width 288column positions for multiple text-column output only. 289If the 290.Fl w 291option is not specified and the 292.Fl s 293option is not specified, the default width is 72. 294If the 295.Fl w 296option is not specified and the 297.Fl s 298option is specified, the default width is 512. 299.It Ar file 300A pathname of a file to be printed. 301If no 302.Ar file 303operands are specified, or if a 304.Ar file 305operand is 306.Sq Fl , 307the standard input is used. 308The standard input is used only if no 309.Ar file 310operands are specified, or if a 311.Ar file 312operand is 313.Sq Fl . 314.El 315.Pp 316The 317.Fl s 318option does not allow the option letter to be separated from its 319argument, and the options 320.Fl e , 321.Fl i , 322and 323.Fl n 324require that both arguments, if present, not be separated from the option 325letter. 326.Sh ERRORS 327.Pp 328If 329.Nm pr 330receives an interrupt while printing to a terminal, it 331flushes all accumulated error messages to the screen before 332terminating. 333.Pp 334The 335.Nm pr 336utility exits 0 on success, and 1 if an error occurs. 337.Pp 338Error messages are written to standard error during the printing 339process (if output is redirected) or after all successful 340file printing is complete (when printing to a terminal). 341.Sh SEE ALSO 342.Xr cat 1 , 343.Xr more 1 344.Sh STANDARDS 345The 346.Nm pr 347utility is 348.St -p1003.2 349compatible. 350