Sort by the second character of the 1th field, if the field is only 1 characters followed by a number, the order of the letters after the normal sort of 2 characters
Repeated lines in a uniq are repeated without repeating rows, such as:
1
1
2
2
And the sort in-u to achieve uniqueness, that is, the meaning of removing duplicate rows:
1
1
2
2
And
1
2
3
1
Two kinds of
I thought for a long while to figure out, first sort of the neighboring are photographed together, and then use Uniq to show the number of adjacency
awk ' {print $} ' zzz |awk-f \ ' {print $} ' |sort-n |uniq-c
5 GBCD
2 GBCD
3 2222
awk ' {print $} ' zzz |awk-f \ ' {print $} ' |uniq-c |sort-n
1 GBCD
4 GBCD
1 GBCD
1 2222
1 GBCD
2 2222
Because in a virtual host and IDC company work, so often the site is attacked, the virtual host in the server will have multiple sites, in order to find out from the log that domain name of the network number and access traffic is too large to write the following operations.
As practical as:
Tail-f/var/log/http/access |awk ' {print $} ' zzz |awk-f \ ' {print $} ' |sort-n |uniq-c
Or
Tail-f/var/log/http/access >>ABC
Again
SORT-N ABC |uniq-c
This allows you to measure the number of visits to some domain names during a certain time period.
2009-09-01
This article is from the "Five Corners" blog, please be sure to keep this source http://hi289.blog.51cto.com/4513812/1762332
Shell Uniq and sort simple usage and examples