UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: picChapter 2
Unix Commands
Next: Reference: printenv
 

pr

pr [options] [files]

Format one or more files according to options to standard output. Each page includes a heading that consists of the page number, filename, date, and time. When files are named directly, the date and time are those of the file's modification time. Otherwise, the current date and time are used.

Options

-a

Multicolumn format; list items in rows going across.

-d

Double-spaced format.

-e[cn]

Set input tabs to every nth position (default is 8), and use c as field delimiter (default is a tab).

-f

Separate pages using formfeed character (^L) instead of a series of blank lines.

-F

Fold input lines (avoids truncation by -a or -m).

-hstr

Replace default header with string str.

-icn

For output, replace whitespace with field delimiter c (default is a tab) every nth position (default is 8).

-ln

Set page length to n lines (default is 66).

-m

Merge files, printing one in each column (can't be used with -n and -a). Text is chopped to fit. See also paste.

-n[cn]

Number lines with numbers n digits in length (default is 5), followed by field separator c (default is a tab). See also nl.

-on

Offset each line n spaces (default is 0).

-p

Pause before each page.

-r

Suppress messages for files that can't be found.

-sc

Separate columns with c (default is a tab).

-t

Omit the page header and trailing blank lines.

-wn

Set line width to n (default is 72).

+num

Begin printing at page num (default is 1).

-n

Produce output having n columns (default is 1); tabs are expanded as with -i.

Examples

Print a side-by-side list, omitting heading and extra lines:

pr -m -t list.1 list.2 list.3

Alphabetize a list of states; number the lines in five columns:

sort states_50 | pr -n -5


Previous: Reference: picUNIX in a Nutshell: System V EditionNext: Reference: printenv
Reference: picBook IndexReference: printenv

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System