Simple Linux Command Line notes: FMT

Source: Internet
Author: User
ArticleDirectory
    • Parameters
    • Option
    • Example

Simple Text Formatting

FMT [Option] [File-list]

 

FMT performs simple text formatting by setting the length of all non-blank rows to almost the same

 

Parameters

FMTSlaveFile-listAnd the formatted version of the content is sent to the standard output. If you do not specify a file name or use a hyphen(-)To replace the file name, FMT reads text information from the standard input.

 

Option

-S: truncates long rows but does not merge them.

-T indented except the first line of each paragraph

-U changes the format so that there is a space between words and two spaces between sentences.

-W n: Change the output line width to n characters. Without this option, the FMT output line width is 75 characters

 

Example

Original file

 
$CatDemoLong TimeAgo, there was a huge apple tree. A little boy loved to come and play around it every day. He climbed to the tree top, ate the apples, took a nap under the shadow... He loved the tree and the tree loved to play with him.

 

FMT-S
$FMT-S demoLong TimeAgo, there was a huge apple tree. A little boy lovedto come and play around it every day. He climbed to the tree top, atethe apples, took a nap under the shadow... He loved the tree and Thetree loved to play with him.

Truncation of long rows

 

FMT-T
$FMT-T demoLong TimeAgo, there was a huge apple tree. A little boy loved to come and play around it every day. He climbed to the tree top, ate the apples, took a nap under the shadow... He loved the tree and the tree loved to play with him.

Exclude indentation of the first line

 

FMT-u
$FMT-U demoLong TimeAgo, there was a huge apple tree. A little boy loved to comeand play around it every day. He climbed to the tree top, ate the apples, took a nap under the shadow... He loved the tree and the tree loved toplay with him.

The interval between formatting words and sentences. Obviously, multiple spaces in a little boy are truncated to two

 

FMT-W
$FMT-W 40DemoLong TimeAgo, there was a hugeapple tree. A little boyloved to come and play around itevery day. He climbed to the tree top, ate the apples, took a nap under theshadow... He loved the tree and Thetree loved to play with him.

Specify the output line width. The line width here is 40 characters long and I have never counted it.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.