commands
fmt — reflow text paragraphs
Reformat plain-text paragraphs toward a target width; -w sets maximum width (except indivisible long words). Can alter record boundaries; avoid for structured data. Example assumes a fresh text-streams lab fixture.
Formal Syntax & Structure
linux syntaxlinux
fmt [OPTION]... [FILE]...Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| -w | option | Takes a maximum line width in columns; an indivisible long word can exceed it. |
| FILE | operand | Input file; omit or use - to read stdin. |
Return Value
exit status and output
GNU fmt writes reformatted text and returns nonzero on read/write errors. Long indivisible words may exceed the requested width without failure; compare output before using it as a record format.
Working Example
Example Snippetlinux
fmt -w 20 paragraph.txt