APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

fold, fmt

Similar in intent, but fmt is the more powerful of the two.

The purpose is to reformat lines to fit a fixed width output device, and to do it intelligently so that lines are broken at appropriate places rather than mid wo
rd (like that).

Within vi, you can simply do ":.!fmt" to fix an unruly paragraph, or ":1,$!fmt" to do the entire document. That's simple usage, "fmt" has many useful options.

Of course, "fmt file | lpr" can also be useful.

Got something to add? Send me email.

1 comment

Increase ad revenue 50-250% with Ezoic

More Articles by

Find me on Google+

© Tony Lawrence

Thanks for the tip! No more 'fold' for me - 'fmt' works much better when printing README files to the printer!

- Bruce Garlock

Kerio Samepage

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us