yjt1993

文件如下:

[root@manager1 bin 17:26:53]#cat mm.txt 
www.baidu.com|1|192.168.1.2|23
www.google.com|1|192.168.2.3|12
www.baidu.com|1|192.168.1.2|37
www.baidu.com|1|192.168.1.2|55
www.google.com|1|192.168.2.3|12
www.google.com|1|192.168.2.3|18
www.google.com|1|192.168.2.3|20
www.ailibb.com|2|192.168.2.4|12

统计每个域名的访问量,访问量为上述文件信息的第四个字段

[root@manager1 bin 17:26:48]#awk -F\'|\' \'{sum[$1]+=$4}END{for(i in sum){print i"|"sum[i]}}\'  mm.txt |sort -t \'|\' -k 2 -nr |head -50
www.baidu.com|115
www.google.com|62
www.ailibb.com|12

 

分类:

技术点:

相关文章:

  • 2021-06-06
  • 2021-12-26
  • 2021-06-06
  • 2021-11-08
  • 2021-12-30
  • 2022-02-09
猜你喜欢
  • 2022-03-03
  • 2021-06-04
  • 2021-09-21
  • 2021-09-30
  • 2021-11-10
  • 2021-05-10
  • 2022-12-23
相关资源
相似解决方案