The prints what you send it. If you send it a continuous stream of text (and the printer is set up to print text files rather than PostScript), that's just what you'll probably get: no page breaks, indenting, or other formatting features.
That's where pr comes in. It's a simple formatter that breaks its input into "pages" that will fit onto a standard 66-line page. (Well, US standard anyway.) It adds a header that automatically includes the date and time, the file name, and a page number. It also adds a footer that ensures that text doesn't run off the bottom of the page.
This is just what you want if you are sending program source code or other streams of unbroken text to a printer. For that matter, pr is often very handy for sending text to your screen. In addition to its default behavior, it has quite a few useful options:
Separate pages using formfeed character (^L) instead of a series of blank lines.
Replace default header with string str. See article 35.17.
Set page length to n (default is 66).
Merge files, printing one in each column (can't be used with -num and -a). Text is chopped to fit. See article 35.17. This is a poor man's .
Separate columns with c (default is a tab).
Omit the page header and trailing blank lines.
Set line width for output made into columns to num (default is 72).
Begin printing at page num (default is 1).
Produce output having n columns (default is 1). See article 35.17.
There are also options that apply only to the System V version:
Multi-column format; list items in rows going across.
Set input tabs to every nth position (default is 8), and use c as field delimiter (default is a tab).
Fold input lines (avoids truncation by -a or -m).
For output, replace white space with field delimiter c (default is a tab) every nth position (default is 8).
Number lines with numbers n digits in length (default is 5), followed by field separator c (default is a tab). See also nl.
Offset each line n spaces (default is 0).
Pause before each page.
Suppress messages for files that can't be found.
Let's put this all together with a couple of 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. First, with the System V options:
sort states_50 | pr -n -5
On a BSD system, which doesn't support -n, you can useto supply the line numbers:
sort states_50 | cat -n | pr -5
To get output on BSD that's identical to System V, you'll need to set a column length:
sort states_50 | cat -n | pr -t -5 - | 10 | pr -h states_50