Share on Facebook Share on Twitter Email
Answers.com

Fmt

 

The fmt command in Unix is used 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 Unixes, 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 as closely as possible, rather than wrapping the input lines exactly as fold (from GNU Core Utilities) does.

In most implementations of fmt, the word wrap optimization procedure usually requires two criteria: the target output line width, and the maximum acceptable line width (which should be larger than the previous one to give room for optimization). It might be not always possible to give these two options simultaneously. For example, GNU fmt can only accept the maximum width option, which is given by -w switch, or directly -digits as the first command line option for compatibility. See the Solaris man page for fmt[1] and FreeBSD manual entry for fmt[2] for detailed examples, and compare with the latest documentation of GNU fmt utility[3] included by most Linux distributions. Please also refer to the Plan 9 fmt man page.[4]

Example

Given text like this as input:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur dignissim
venenatis pede. Quisque dui dui, ultricies ut, facilisis non, pulvinar non,
purus. Duis quis arcu a purus volutpat iaculis. Morbi id dui in diam ornare
dictum. Praesent consectetuer vehicula ipsum. Praesent tortor massa, congue et,
ornare in, posuere eget, pede. 

Vivamus rhoncus. Quisque lacus. In hac habitasse platea dictumst. Nullam mauris
tellus, sollicitudin non, semper eget, sodales non, pede. Phasellus varius
ullamcorper libero. Fusce ipsum lorem, iaculis nec, vulputate vitae, suscipit
vel, tortor. Cras varius.

Nullam fringilla pellentesque orci. Nulla eu ante pulvinar velit rhoncus
lacinia. Morbi fringilla lacus quis arcu. Vestibulum sem quam, dapibus in,
fringilla ut, venenatis ut, neque.

After passing this through fmt -w 50, the width of each line is at most 50 characters and the text flows within this constraint:

Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Curabitur dignissim venenatis
pede. Quisque dui dui, ultricies ut, facilisis
non, pulvinar non, purus. Duis quis arcu a
purus volutpat iaculis. Morbi id dui in diam
ornare dictum. Praesent consectetuer vehicula
ipsum. Praesent tortor massa, congue et, ornare
in, posuere eget, pede.

Vivamus rhoncus. Quisque lacus. In hac
habitasse platea dictumst. Nullam mauris tellus,
sollicitudin non, semper eget, sodales non,
pede. Phasellus varius ullamcorper libero. Fusce
ipsum lorem, iaculis nec, vulputate vitae,
suscipit vel, tortor. Cras varius.

Nullam fringilla pellentesque orci. Nulla eu ante
pulvinar velit rhoncus lacinia. Morbi fringilla
lacus quis arcu. Vestibulum sem quam, dapibus in,
fringilla ut, venenatis ut, neque.

See also

References



Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
Shopping: Fmt
Top
 
 
Learn More
extension F (technology)
Hell Sweet Hell [Japan Bonus Track] (2005 Album by Fear My Thoughts)
Typenturm

Help us answer these
When your boyfriend and you are married here in Mexico you are from New Zealand him Mexico do you still need to have a FMT or 3?

Post a question - any question - to the WikiAnswers community:

 

Copyrights:

Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "Fmt" Read more