fmt utility is a part of GNU core utilities and allows to reformat paragraph text writing to standard output. It also can read input from stdin.

Usage example:

Let’s assume you have big one-line text file (all words are placed in one single line and there are no returns characters there at all). In order to format this file with fmt just execute fmt /path/to/file and you’ll get 72 characters wide output like this:

viper@viper-laptop:~$ fmt /tmp/test
The GNU Project was launched in 1984 to develop a complete Unix-like
operating system which is free software: the GNU system. Variants of
the GNU operating system, which use the kernel called Linux, are now
widely used; though these systems are often referred to as “Linux”,
they are more accurately called GNU/Linux systems.

If you’d like to reduce line width and make it 40 chars wide just execute fmt -40 /path/to/file and you’ll get:

viper@viper-laptop:~$ fmt -40 /tmp/test
The GNU Project was launched in 1984 to
develop a complete Unix-like operating
system which is free software: the GNU
system. Variants of the GNU operating
system, which use the kernel called
Linux, are now widely used; though
these systems are often referred to as
“Linux”, they are more accurately
called GNU/Linux systems.

 

6 Comments

 

  1. April 20, 2011  9:52 am by Tarot barato Reply

    Certainly I like your web site, but you have to test the spelling on quite a few of your posts. Several of them are rife with spelling issues and I find it very bothersome to inform you. However I will definitely come again again!

  2. April 23, 2011  6:16 pm by hkseo.us Reply

    This always amazes me exactly how bloggers such as yourself can find some time and also the dedication to carry on producing superb discussions. Your blog iswonderful and one of my own must read blogs and forums. I simply want to say thanks.

  3. April 23, 2011  6:54 pm by affordable Reply

    I think other site owners should take this web site as an model - very clean and great style and design, as well as the content. You're an expert in this topic!

  4. April 25, 2011  10:42 am by Coches de ocasion Reply

    Whats up. Very cool web site!! Guy .. Excellent .. Superb .. I'll bookmark your website and take the feeds additionally...I am satisfied to locate a lot of helpful info here in the post. Thank you for sharing...

  5. September 17, 2012  1:17 pm by icons package Reply

    I consider, that you are not right. Let's discuss it. Write to me in PM, we will talk.


    P.S. Please review icons

Leave a reply

 

Your email address will not be published.