fmt

Reformat a text file by joining its paragraphs and limiting the line width to given number of characters (75 by default). More information: <https://www.gnu.org/software/coreutils/fmt>.

Install

All systems
curl cmd.cat/fmt.sh
Debian Debian
apt-get install coreutils
Ubuntu
apt-get install coreutils
Alpine
apk add coreutils
Arch Arch Linux
pacman -S coreutils
image/svg+xml Kali Linux
apt-get install coreutils
CentOS
yum install coreutils
Fedora
dnf install coreutils
Windows (WSL2)
sudo apt-get update sudo apt-get install coreutils
OS X
brew install coreutils
Raspbian
apt-get install coreutils
Docker
docker run cmd.cat/fmt fmt powered by Commando

Reformat a text file by joining its paragraphs and limiting the line width to given number of characters (75 by default). More information: <https://www.gnu.org/software/coreutils/fmt>.

  • Reformat a file:
    fmt path/to/file
  • Reformat a file producing output lines of (at most) `n` characters:
    fmt -w n path/to/file
  • Reformat a file without joining lines shorter than the given width together:
    fmt -s path/to/file
  • Reformat a file with uniform spacing (1 space between words and 2 spaces between paragraphs):
    fmt -u path/to/file

© tl;dr; authors and contributors