Linux and Unix fmt command
Quick links
About fmt
Syntax
Examples
Related commands
Linux and Unix main page
Simple text formatters.
fmt [-c] [-s] [-w width | -width ] [inputfile]
| -c | Crown margin mode. Preserve the indentation of the first two lines within a paragraph, and align the left margin of each subsequent line with that of the second line. This is useful for tagged paragraphs. |
| -s | Split lines only. Do not join short lines to form longer ones. This prevents sample lines of code, and other such formatted text, from being unduly combined. |
| -w width | -width | Fill output lines to up to width columns. |
| inputfile | The input file. |
fmt myfile.txt
Display a formatted version of the file myfile.txt. To direct the results to another file (such as myfile2.txt) type the below command.
fmt < myfile.txt > myfile2.txt
