candy 发表于 2018-8-22 10:00:25

每日一shell(二)日志IP统计排序

  统计分析文中的log文件的每个IP的访问量并由高到低排序
http://s1.51cto.com/images/20171211/1512998312600916.jpg?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=
  把文件下载到本地改后缀
#!/bin/bash  
awk '{print $1}' ip.log | sort | uniq -c | sort -rn | more
  sh -x uniqip.sh
  + awk '{print $1}' ip.log
  + sort
  + uniq -c
  + sort -rn
  + more
  19 59.58.137.166
  17 64.31.32.131
  16 210.72.154.243
  12 36.249.165.107
  12 27.184.41.29
  10 120.42.87.69
  10 112.111.188.62
  9 58.246.163.139
  8 124.127.244.1


页: [1]
查看完整版本: 每日一shell(二)日志IP统计排序