In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of how to use the uniq command in Linux, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on how to use the uniq command in Linux. Let's take a look at it.
In Linux systems, the main function of the uniq command is to check and delete repeated rows in text files, usually in conjunction with the sort command.
Syntax uniq [- cdu] [- f] [- s] [- w] [--help] [--version] [input file] [output file] parameter:-c or-count displays the number of times the row is repeated next to each column.
-d or-repeated displays only recurring rows and rows.
-f or-skip-fields= ignores the comparison of the specified fields.
-s or-skip-chars= ignores the characters specified by the comparison.
-u or-unique shows the row only once.
-w or-check-chars= specifies the characters to compare.
-help displays help.
-version displays version information.
[input File] specifies the sorted text file. If this item is not specified, the data is read from the standard
[output File] specifies the output file. If this option is not specified, the content is displayed to the standard output device (display terminal).
Case demonstration: delete duplicate lines:
Uniq file.txt sort file.txt | uniq sort-u file.txt displays only a single line:
Uniq-u file.txt sort file.txt | uniq-u counts the number of times each line appears in the file:
Sort file.txt | uniq-c finds duplicate lines in the file:
Sort file.txt | uniq-d this article on "how to use uniq commands in Linux" ends here. Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to use uniq commands in Linux". If you want to learn more, you are welcome to follow the industry information channel.
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.