The System V version of
pr
(43.7
)
has a -F
option for folding lines that are too wide for the
output page: the printer won't truncate them.
If you print lots of random data and stuff that may have long lines
and your pr
doesn't have -F
, try the fold
command
instead.

fold
arbitrarily breaks lines that are too long, by default at
80 columns. Use -width
where width
is the desired
column to fold at for some other breaking point.

I made an
alias (10.2
)
and
shell function (10.9
)
called prF
to do that.
It prints a single file and puts the filename in the pr
heading
(usually, if you pipe to pr
, it won't know the filename).
You might want to add | lpr
onto the end of this, too:

A good way to see which lines are folded is with line numbering.
pr
versions without -F
usually don't have -n
either.
You can add it to your alias with
cat -n
(25.21
)
.
The lines will be numbered before they're folded:

alias prnF 'cat -n \!^ | fold | pr -h "\!^"'

To shorten lines by folding them after a word near the right-hand end
(instead of at some particluar column), try
fmt
(35.2
)
.