Fixing Margins with pr and fold
The System V version of pr () 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 () and shell function () 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:
alias prF 'fold \!^ | pr -h "\!^"'
csh_init
sh_init | 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 (). 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 ().
- JP