Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cat(1)

mesg(1)

pr(1)  —  Commands

OSF

NAME

pr − Writes a file to standard output

SYNOPSIS

pr [−adfmprt] [−e[character][number]] [−h string] [−i[character][number]]
     [−l[number]] [−n[character][number]] | [−x[character][number]]
     [−o[number] [−s[character] [−[number] [+[number] [file ...]

The pr command writes file to standard output.  If you do not specify file or if file is -, pr reads standard input. 

FLAGS

-aDisplays multicolumn output across the page. 

-dDoublespaces the output. 

-e[characterl][number]
Expands tabs to byte positions number+1, 2∗number+1, 3∗number+1, and so on.  The default value of number is 8.  Tab characters in the input expand to the appropriate number of spaces to line up with the next tab setting.  If you specify character (any character other than a digit) that character becomes the input tab character.  The default value of character is the ASCII tab character. 

-fUses a formfeed character to advance to a new page.  (Otherwise, pr issues a sequence of linefeed characters.)  Pauses before beginning the first page if the standard output is a tty. 

-hDisplays string as the page header instead of the filename.  -h and string must be separated by a space. 

-i[character][number]
Replaces white space wherever possible by inserting tabs to positions number+1, 2∗number+1, 3∗number+1, and so on.  The default value of number is 8.  If you specify character (any character other than a digit), that character becomes the output tab character.  (The default value of character is the ASCII tab character.) 

-lnumberSets the length of a page to number lines (the default is 66). 

-mCombines and writes all files at the same time, with each file in a separate column.  (This overrides the -number and -a flags). 

-n[character][number]
Provides number-digit line numbering (the default value of number is 5).  The number occupies the first number+1 positions of each column of normal output (or each line of -m output).  If you specify character (any character, other than a digit), that character is added to the line number to separate it from whatever follows.  (The default value of character is an ASCII tab character.) 

-onumber
Indents each line by number byte positions (the default is 0).  The number of byte positions per line is the sum of the width and offset. 

-pPauses before beginning each page if the output is directed to a tty.  (pr sounds the bell at the tty and waits for you to press <Return>.) 

-rDoes not display diagnostic messages if the system cannot open files. 

-scharacter
Separates columns by the single character instead of by the appropriate number of spaces (the default for character is an ASCII tab character). 

-tDoes not display the 5-line identifying header and the 5-line footer.  Stops after the last line of each file without spacing to the end of the page. 

-x[character][number]
Same as -n. 

-wnumber
Sets the width of a line to number byte positions (the default value is 72 for equal-width, multicolumn output, no limit otherwise). 

-numberProduces number-column output (the default value is 1).  The -e and -i flags are assumed for multicolumn output. 

+number
Begins the display with page number (the default value is 1). 

DESCRIPTION

A heading that contains the page number, date, time, and the name of the file separates the output into pages. 

Unless specified, columns are of equal width and separated by at least one space.  Lines that are too long for the page width are shortened.  If the standard output is a tty, pr does not display any error messages until it has ended. 

EXAMPLES

     1.To print a file with headings and page numbers on the printer, enter:

pr  prog.c | print

This inserts a page break in prog.c, starts each page with a heading, and sends the output to the print command.  The heading consists of the date the file was last modified, the filename, and the page number. 

     2.To specify a title, enter:

pr  -h  "MAIN  PROGRAM"  prog.c  ⏐  print

This prints prog.c with the title MAIN PROGRAM in place of the filename.  The modification date and page number are still printed. 

     3.To print a file in multiple columns, enter:

pr  -3  word.lst  ⏐  print

This prints the file word.lst in three vertical columns. 

     4.To print several files side-by-side on the paper, enter:

pr -m -h "Members, Visitors" member.lst visitor.lst | print

This prints the files member.lst and visitor.lst side-by-side with the title Members, Visitors. 

     5.To modify a file for later use, enter:

pr  -t  -e  prog.c  > prog.notab.c

This replaces tab characters in prog.c with spaces and puts the result in prog.notab.c.  Tab positions are at byte positions 9, 17, 25, 33, and so on.  The -e tells pr to replace the tab characters; the -t suppresses the page headings. 

RELATED INFORMATION

Commands:  cat(1), mesg(1). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026