In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about how to use the fmt command in Linux. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.
Linux fmt command
The fmt command is a simple text formatting tool that anyone can run from the command line. Its basic syntax is:
Fmt [- WIDTH] [OPTION]... [FILE]...
Its man page says:
Reformat each paragraph in the file to write the results to standard output. The option-WIDTH is an acronym for-- width=DIGITS form.
The following examples of questions and answers should give you a good understanding of the use of fmt.
Q1. How do I use fmt to format text content on the same line?
You can do this using the basic form of the fmt command (omitting any options). You just need to pass it the file name as an argument.
Fmt [file-name]
The following screenshot shows the execution result of the command:
Format contents of file in single line
You can see that multiple lines in the file are formatted into the same line. Note that this does not modify the original file (file1).
Q2. How to modify the line width of * *?
By default, the * * line width in the output produced by the fmt command is 75. However, you can modify it with the-w option if you want, which accepts a number representing the new line width as the parameter value.
Fmt-w [n] [file-name]
The following example reduces the line width to 20:
Change maximum line width
Q3. How to make fmt highlight * * lines?
This is done by making the indentation of the * line different, which you can do with the-t option.
Fmt-t [file-name]
Make fmt highlight the first line
Q4. How to split long rows using fmt?
The fmt command can also be used to split long lines, which you can apply using the-s option.
Fmt-s [file-name]
Here is an example:
Make fmt split long lines
Q5. How to separate words from words and sentences by spaces?
The fmt command provides a-u option, which separates words from words with a single space and sentences with two spaces. You can use it like this:
Fmt-u [file-name] after reading the above, do you have any further understanding of how to use the fmt command in Linux? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.