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.
More Articles by Tony Lawrence © 2011-07-07 Tony Lawrence
Don't blame me for the fact that competent programming, as I view it as an intellectual possibility, will be too difficult for "the average programmer" — you must not fall into the trap of rejecting a surgical technique because it is beyond the capabilities of the barber in his shop around the corner. (Edsger W. Dijkstra)
Thanks for the tip! No more 'fold' for me - 'fmt' works much better when printing README files to the printer!
- Bruce Garlock
------------------------
Printer Friendly Version
fmt Copyright © November 2003 Tony Lawrence
Have you tried Searching this site?
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
Printer Friendly Version