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/02 Report--
The sort tool sort is a tool that sorts the contents of a file by behavior unit and can also be sorted by different data types. Sort syntax sort [options] parameter sort Common option-f: ignore case-b: ignore spaces before each line-M: sort by month-n: sort by number-r: reverse sort-u: show the same data only one line (excluding discontinuous repetitions)-t: specify the delimiter By default, the [Tab] key is used to separate-o: transfer the sorted results to the specified file-k: a sample demo of the specified sorting area
Sort the third column in the / etc/passwd file and save the output to the user.txt file
[root@localhost ~] # sort-t':'- k 3 / etc/passwd-o user.txt / / sort the third column in the / etc/passwd file And save the output to the user.txt file [root@localhost ~] # cat user.txt / / View the file root:x:0:0:root:/root:/bin/bashczt:x:1000:1000:czt:/home/czt:/bin/bashccc:x:1001:1001::/home/ccc:/bin/bash.uniq tool Uniq tool is usually used in conjunction with the sort command in Linux systems to report or ignore duplicate lines in the file. Uniq Syntax uniq [options] parameters uniq Common options-c: count-d: show only duplicate lines-u: show only lines that occur once (remove only consecutive repetitions) sample demonstration
Delete duplicate lines in the testfile file and show the number of times the line repeats at the beginning of the line
[root@localhost ~] # vim testfileLinux 10Linux 20Linux 30Linux 30Linux 30CentOS 6.5CentOS 6.5CentOS 6.5CentOS 7.3CentOS 7.3CentOS 7.3 [root@localhost ~] # uniq-c testfile / / * Delete duplicate lines in the testfile file and display the number of repetitions of the line at the beginning of the line 1 Linux 10 1 Linux 20 3 Linux 30 3CentOS 6.5 3CentOS 7.3
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.