Preparing to Print with pr

Although old-fashioned line printers—those obnoxiously loud ones that clatter out character by character, or the dot-matrix printers that zing out line after line—aren’t terribly easy to find anymore, the pr command is finding new life in the age of the Internet.

Why? Well, nothing says email as quickly, easily, effectively, and safely as plain text. Plain text attaches no viruses. Plain text works in every email system, including handheld computers, and the like. Plain text works great—often better than a word processor— for one-off messages, pages, and short documents that just don’t merit firing up a full-blown word processor. Code Listing 6.22 shows an example of text processed with pr.

To Process with pr:

  • pr spiderstory.formatted

    Turn pr loose, and you’ll be the talk of the town.

✓ Tips

  • Two utilities that work great together are fmt and pr. See Code Listing 6.22 to see what fmt -w 30 spiderstory. unformatted | pr -2 will do for you.

  • Use the –n and –d flags if you’re printing something that will be reviewed by others. Using these flags, you get line numbers and double-spacing, which will make the review process easier.

  • Add in a –T flag so the output doesn’t even pretend to be appropriate for a printer— there are no headers or footers or other pagination for actual printed output.


Code Listing 6.22. The pr utility can help you get your output spiffed up, even if you aren’t printing it.
[jdoe@frazz jdoe]$ pr spiderstory.formatted
2003-01-01 12:   spiderstory.formatted  Page 1

This morning I got up, went downstairs, and found a HUMONGOUS spider in
the bathroom where the little potty is.  After I quietly composed myself
from the shock (I didn't want to alert the kids),
I looked around the house for something to put him in...the kids' bug catcher thing
(nowhere to be found)...a jar...tupperware...a lidded cup...the salad spinner
(BwaaaaHaaaHaaa!)....
I went back and checked on the spider and decided that I just couldn't face putting
him in something.  I mean, what if he got close to me...or TOUCHED me?!?!  And, since
I hate the crunching sound and feel of squashing bugs, I knew I couldn't just kill
him.  This    spider had *bones*, I'm tellin' ya'. So, I hunted for bug spray. And
hunted. But nothing.
[jdoe@frazz jdoe]$ fmt -u -w 30 spiderstory.unformatted | pr—columns=2
2003-01-01 12:59 Page 1

This morning I got up,           (BwaaaaHaaaHaaa!)....
went downstairs, and found       I went back and checked on
a HUMONGOUS spider in the        the spider and decided that
bathroom where the little        I just couldn't face putting
potty is.  After I quietly       him in something.  I mean,
composed myself from the         what if he got close to
shock (I didn't want to alert    me...or TOUCHED me?!?! And
the kids),                       since I hate the crunching
                                 sound and feel of squashing
I looked around the house for    bugs, I knew I couldn't just
something to put him in...the    kill him.  This spider had
kids' bug catcher thing          *bones*, I'm tellin' ya'. So,
(nowhere to be found)...a        I hunted for bug spray.
jar...tupperware...a lidded      And hunted. But nothing.
cup...the salad spinner

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.129.100