In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Sort tool
(1) sort is a tool for sorting file contents by behavior unit, and it can also be sorted according to different data types.
(2) sort command format: sort [option] parameter
(3) commonly used options:
-f: ignore case;-b: ignore spaces in front of each line;-M: sort by month;-n: sort by number;-r: sort in reverse;-u: equivalent to uniq, indicating that only one row of the same data is displayed;-t: specify a delimiter, separated by [Tab] key by default;-o: save the sorted results to the specified file
-k: specify the sort area
Example 1: sort the accounts in the / etc/passwd file
Sort / etc/passwd
Example 2: reverse sort the third column in the / etc/passwd file
Sort-t:-rk 3 / etc/passwd
Example 3: sort the third column in the etc/passwd file and save the output to the yyy.txt file
Sort-t:-k 3 / etc/passwd-o yyy.txt II, uniq tool
(1) the uniq tool is usually used in conjunction with the sort command in Linux systems to report or ignore duplicate lines in a file.
(2) the command syntax format is: uniq [option] parameter
(3) Common options include:
-c: count;-d: show only duplicate lines
-u: displays only rows that appear once
Example 1:uniq command to deduplicate, can only be repeated continuously, if separated, it will still appear.
If we want to remove all duplicate lines and only appear once, we can use the sort-u command
III. Wc tools
(1) count the number of bytes, words and lines in the specified file, and display the statistical results. This command counts the number of bytes, words, and lines in the specified file. If no file name is given, it is read from standard input. Wc also gives the presidential count of the specified file.
(2) format: wc [options] file
(3) Common options:
-c counts the number of bytes;-l counts the number of lines;-m counts the number of characters. Note that this flag cannot be used with the-c flag;-w counts the number of words; a word is defined as a string separated by white space, tabs, or newline characters;-L prints the length of the longest line.
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.