Fmt (Unix)

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 given by user as closely as possible, rather than wraps 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, although 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 [ cite web | url = http://docs.sun.com/app/docs/doc/816-5165/fmt-1?l=en&a=view&q=fmt | title = Solaris 10 Reference Manual Collection | publisher = Sun] and FreeBSD manual entry for fmt [ cite web | url = http://www.freebsd.org/cgi/man.cgi?query=fmt&sektion=1&apropos=0&manpath=FreeBSD+6.2-RELEASE | title = FreeBSD General Commands Manual | publisher = FreeBSD] for detailed examples, and compare with the latest documentation of GNU fmt utility [ cite web | url = http://www.gnu.org/software/coreutils/manual/html_node/fmt-invocation.html | title = GNU Coreutils Documentation | publisher = FSF] included by most Linux distributions. Please also refer to the Plan 9 fmt man page [ cite web | url = http://plan9.bell-labs.com/magic/man2html/1/fmt | title = Plan 9 /sys/man/1/fmt | publisher = Lucent Technologies | date = 2007] .

Example

Given text like this as input:

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

Vivamus rhoncus. Quisque lacus. In hac habitasse platea dictumst. Nullam mauristellus, sollicitudin non, semper eget, sodales non, pede. Phasellus variusullamcorper libero. Fusce ipsum lorem, iaculis nec, vulputate vitae, suscipitvel, tortor. Cras varius.

Nullam fringilla pellentesque orci. Nulla eu ante pulvinar velit rhoncuslacinia. 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, consectetueradipiscing elit. Curabitur dignissim venenatispede. Quisque dui dui, ultricies ut, facilisisnon, pulvinar non, purus. Duis quis arcu apurus volutpat iaculis. Morbi id dui in diamornare dictum. Praesent consectetuer vehiculaipsum. Praesent tortor massa, congue et, ornarein, posuere eget, pede.

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

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

See also

* List of Unix commands

References


Wikimedia Foundation. 2010.

Look at other dictionaries:

  • fmt — unix утилита, переформатирует каждый абзац в файле(ах) и выводит на стандартный вывод. Содержание 1 Использование 2 Параметры запуска в GNU 3 …   Википедия

  • Fmt — unix утилита, переформатирует каждый абзац в файле(ах) и выводит на стандартный вывод. Содержание 1 Использование 2 Параметры запуска 3 …   Википедия

  • FMT — Die Abkürzung FMT steht für: Fernmeldetechnik Fernmeldeturm Fade mitigation techniques, siehe Fading (Elektrotechnik) Flugmodell und Technik, den Titel einer Fachzeitschrift für Flugzeugmodellbau fmt steht für: die Dateinamenserweiterung „Format… …   Deutsch Wikipedia

  • FMT — • Format • Fernmeldeturm • Flight Management Team NASA Luftfahrt / Weltraumfahrt • Fine grain Multi Threading • fmt simle optimal text formatter Text Formatierer unter LINUX/BSD UNIX http://www.desy.de/cgi bin/man cgifmt …   Acronyms

  • FMT — [1] Format [2] Fernmeldeturm [3] Flight Management Team ( > NASA Acronym List ) {Luftfahrt}/{Weltraumfahrt} [4] Fine grain Multi Threading [2] fmt simle optimal text formatter Text Formatierer unter LINUX/BSD UNIX (http://www.desy.de/cgi… …   Acronyms von A bis Z

  • date (Unix) — Unix date command The Unix date command displays the time and date. The super user can use it to set the system clock. Contents 1 Usage 2 Formatting …   Wikipedia

  • List of Unix utilities — This is a list of UNIX utilities as specified by IEEE Std 1003.1 2008, which is part of the Single UNIX Specification (SUS). These utilities can be found on UNIX Operating systems and most UNIX like operating systems. List IEEE Std 1003.1 2008… …   Wikipedia

  • Программы UNIX-подобных операционных систем — Это список популярных программ, работающих в операционных системах основанных на UNIX (POSIX совместимых). Некоторые из этих программ являются стандартными для UNIX подобных систем. Содержание 1 Системный софт 1.1 Общего назначения …   Википедия

  • dd (Unix) — In computing, dd is a common Unix program whose primary purpose is the low level copying and conversion of raw data. According to the manual page for Version 7 Unix,[1] it will convert and copy a file . It is used to copy a specified number of… …   Wikipedia

  • df (Unix) — df (abbreviation for disk free) is a standard Unix computer program used to display the amount of available disk space for filesystems on which the invoking user has appropriate read access. df is usually implemented by reading the mtab file or… …   Wikipedia


Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”

We are using cookies for the best presentation of our site. Continuing to use this site, you agree with this.