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)