I got some logs which recorded someone IP address and the URL it requests, I want to summary how many unique IP addresses request some specified URL, and request counts for one IP address.
so I filter out specified URL rows:
1
|
|
then I got these rows:
1 2 3 4 5 6 7 8 |
|
then I use awk
print the fourth column:
1
|
|
then I got these IPs, I stored these IPs to a file, then sort
and uniq
, the uniq
excepts a sorted file, the -c
option means count these rows:
1
|
|
then I got some unique rows with counts, but I want sort these rows order by counts desc:
1
|
|
the -k1nr
means the KEY starts with first field, and as (n)umber, and ®everse, the -k2
means ends with second field. The field
means the column in your data.