LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pr

Paginate and format text for printing

TLDR

Format file for printing
$ pr [file]
copy
Add page header
$ pr -h "[Header Text]" [file]
copy
Multi-column output
$ pr -[3] [file]
copy
Double space output
$ pr -d [file]
copy
Number lines
$ pr -n [file]
copy

SYNOPSIS

pr [options] [files]

DESCRIPTION

pr formats text files for printing by adding page headers (with filename and date), footers, page breaks, and line numbers. It can arrange text into multiple columns and control page dimensions including length, width, and margins.This traditional Unix utility is useful for preparing plain text documents for printing or for creating formatted multi-column layouts from single-column input. It reads from files or stdin and writes to stdout.

PARAMETERS

FILES

Input files.
-h HEADER
Page header text.
-NUM
Number of columns.
-d
Double space.
-n
Number lines.
-l LINES
Page length.
-w WIDTH
Page width.
-m
Merge files side by side.
-t
Omit headers and footers.
-s CHAR
Separate columns with character.

CAVEATS

Default page length is 66 lines (for 11-inch paper). Headers include filename and date by default. Input must be text; binary files produce unpredictable output.

HISTORY

pr has been part of Unix since the early 1970s at Bell Labs, originally used to prepare text files for line printers. It is specified in POSIX and included in GNU coreutils.

SEE ALSO

fmt(1), fold(1), column(1)

Copied to clipboard
Kai