fmt
[OPTION]... [FICHIER]...
Reformate les paragraphes depuis l’entrée (ou l’entrée standard) vers la sortie standard.
Options
--crown-margin,-c-
First and second line of paragraph may have different indentations, in which case the first line’s indentation is preserved, and each subsequent line’s indentation matches the second line.
--tagged-paragraph,-t-
Like -c, except that the first and second line of a paragraph must have different indentation or they are treated as separate paragraphs.
--preserve-headers,-m-
Attempt to detect and preserve mail headers in the input. Be careful when combining this flag with -p.
--split-only,-s-
Split lines only, do not reflow.
--uniform-spacing,-u-
Insert exactly one space between words, and two between sentences. Sentence breaks in the input are detected as [?!.] followed by two spaces or a newline; other punctuation is not interpreted as a sentence break.
--prefix=<PREFIX>,-p <PREFIX>-
Reformat only lines beginning with PREFIX, reattaching PREFIX to reformatted lines. Unless -x is specified, leading whitespace will be ignored when matching PREFIX.
--skip-prefix=<PSKIP>,-P <PSKIP>-
Do not reformat lines beginning with PSKIP. Unless -X is specified, leading whitespace will be ignored when matching PSKIP
--exact-prefix,-x-
PREFIX must match at the beginning of the line with no preceding whitespace.
--exact-skip-prefix,-X-
PSKIP must match at the beginning of the line with no preceding whitespace.
--width=<WIDTH>,-w <WIDTH>-
Fill output lines up to a maximum of WIDTH columns, default 75. This can be specified as a negative number in the first argument.
--goal=<GOAL>,-g <GOAL>-
Goal width, default of 93% of WIDTH. Must be less than or equal to WIDTH.
--quick,-q-
Break lines more quickly at the expense of a potentially more ragged appearance.
--tab-width=<TABWIDTH>,-T <TABWIDTH>-
Treat tabs as TABWIDTH spaces for determining line length, default 8. Note that this is used only for calculating line lengths; tabs are preserved in the output.
Examples
Reformat a file:
fmt {{path/to/file}}
Reformat a file producing output lines of (at most) n characters:
fmt {{[-w|--width]}} {{n}} {{path/to/file}}
Reformat a file without joining lines shorter than the given width together:
fmt {{[-s|--split-only]}} {{path/to/file}}
Reformat a file with uniform spacing (1 space between words and 2 spaces between paragraphs):
fmt {{[-u|--uniform-spacing]}} {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.