1.sort-nk 1-t-3
2.sort-nk 1-t-2
3.sort-nk 2-t-1
3./ETC/PASSWD sort output from small to large based on the size of the user ID
Sort-nk 1-t-3
4. The/boot directory, output according to the order of the file size, from large to small sequential output
Ls-la |grep ^-|sort-t "-nk 6-r
The 5.ps-aux command can see all the running process information in the system
(1) Identify the process name that consumes the most CPU percentage, and finally output the process name
Ps-aux |sed ' 1d ' |sort-nk 3 |tail-n 3 |sed ' s/.*://g ' |sed ' s/^...//g '
(2) Identify the process name that consumes the most memory percentage, and finally output the process name
Ps-aux |sed ' 1d ' |sort-nk 4 |tail-n 3 |sed ' s/.*://g ' |sed ' s/^...//g '
6. (1) Output the maximum disk name only
DF |sed ' 1d ' |sort-nk 4 |tail-n 1 |sed ' s/. *//g '
DF-M|SORT-NRK 2|head-n 1 |awk ' {print $} '
(2) Output mount point with the largest percentage of disk
DF-H|SORT-NRK 5 |head-n 1|awk ' {print $NF} '
(3) The mount point of the disk with the largest free space output
DF-M|SORT-NRK 4 |head-n 1|awk ' {print $NF} '
Go weight:
1, go to heavy, there are many lines of the same display only one line
Sort-nk 1 4 |uniq-i
2, the output line repeats the number of times, the number of repetitions from large to small sequence output
SORT-NRK 1 4 |uniq-d
3. Output a unique line, that is, no duplicate rows
SORT-NRK 1 4 |uniq-u
118.119.9.21-5119--[27/feb/2014:16:31:56 +0800] 200 0.01
117.64.91.13-1786--[27/feb/2014:16:32:56 +0800] 400 0.20
112.94.95.20-45806--[27/feb/2014:16:33:56 +0800] 404 0.32
27.17.20.242-30972--[27/feb/2014:16:34:56 +0800] 200 0.33
42.121.0.168-53560--[27/feb/2014:16:35:56 +0800] 200 0.55
218.30.103.58-54559--[27/feb/2014:16:36:56 +0800] 200 0.69
1. Get the number of IP address occurrences, sorted by the number of times
SORT-NRK 1 5 |cut-d "-f1 |wc-l
2. Get the number of rows with the last column value greater than 0.5
3. Get the number of rows between 16:40-16:46 and remove the second column
4. Replace all HTTP status 200 with 232
2016/12/22 Classroom Assignments