Formatting with fmt


Formatting with fmt

After you've been typing awaywriting the Great American Novel, perhapsyou might notice that you're suffering from creeping margin uglies, like those shown in Code Listing 6.21. Never fear, fmt can help. Just run your text through fmt, and all will be well.

To Format with fmt:

  • fmt spiderstory.unformatted

    At the shell prompt, just tell fmt to do its thing, and you'll be in business.

Tip

  • You can supplement fmt with handy flags to help make lines more readable. For example, you can often use fmt u to make spacing uniform: one space between words, and two spaces between sentences. Or, try fmt w to specify the width of the formatted text; for example, w 60 would specify a 60-character-wide line.


Code Listing 6.21. With fmt you can clean up all kinds of idiosyncrasies in the format of your documents.

[jdoe@frazz jdoe]$ cat spiderstory.unformatted 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 spiderstory.unformatted 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 spary. And hunted. But nothing. 




Unix(c) Visual Quickstart Guide
UNIX, Third Edition
ISBN: 0321442458
EAN: 2147483647
Year: 2006
Pages: 251

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net