fmt

From Initq

Jump to: navigation, search

Tool to format human language text. It has been traditionally used to reformat email messages after composition and prior to delivery. Its syntax is similar among various Unix, but not identical. fmt attempts to break, fill and join input lines to produce globally optimal, balanced output with the lengths of each line approaching the target width given by user as closely as possible, rather than wraps the input lines exactly as fold (from GNU Core Utilities) does.

Here is an example of fmt. We will change the width of the lines with -w 30 flag.

[alibaba@ohnonono junk]$ cat people.txt
You are not currently logged in. Editing this way will cause your IP address to be 
recorded publicly in this page's edit history. If you create an account,you can conceal 
your IP address and be provided with many other benefits. Messages sent to your IP can be 
viewed on your talk page.

[alibaba@ohnonono junk]$ fmt -w 30 people.txt
You are not currently logged
in. Editing this way will
cause your IP address to be
recorded publicly in this
page's edit history. If you
create an account,you can
conceal your IP address and
be provided with many other
benefits. Messages sent to
your IP can be viewed on your
talk page.
Personal tools