In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail the example analysis of sort in Shell. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
Commonly used parameters
-t,-- field-separator=SEP delimiter: specifies the field delimiter used in sorting, usually used with k
-k,-- key=POS1 [, POS2] specifies the number of columns that need to be sorted, such as-k 1p3sort by the first and third columns.
-b,-- ignore-leading-blanks ignores the space character at the beginning of each line
-d,-- dictionary-order sorts alphabetic, numeric, and space characters in dictionary order. Ignore all other characters
-f,-- ignore-case sorts lowercase letters as uppercase letters.
-I,-- ignore-nonprinting sorts the ASCII characters between 040 and 176, ignoring all other characters.
-r,-- reverse are sorted in reverse order and in reverse order.
-u-- unique removes duplicate records
Other sorting parameters:
-g,-- general-numeric-sort sorts by numeric size. Consistent with n in general, for scientific counting, you can use-g
-n,-- numeric-sort sorts by the numeric size of the characters.
-M,-- month-sort sorts the first three letters by the abbreviation of the month.
-c,-- check checks whether the files have been sorted in order, and the sort is true.
-m,-- merge combines several sorted files.
-o,-- output=FILE stores the sorted results in FILE and does not output in the console.
Examples
? ~ cat 1.txt
AA:BB:CC
Aa:30:6
Cc:50:3
Dd:20:7
Bb:10:2
Ee:40:4
Ee:60:1
To: separate, sort by the third column
? ~ sort-t:-K3 1.txt
Ee:60:1
Bb:10:2
Cc:50:3
Ee:40:4
Aa:30:6
Dd:20:7
AA:BB:CC
This is the end of this article on "sample Analysis of sort in Shell". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.