#统计第一列ip的个数(uniq -c 打印重复行count计数)

cat ip.txt | awk '{print $1}' | sort | uniq -c | sort -rn | head -n 10

#统计tcp连接状态个数

netstat -an | awk '/tcp/{print $6}' | sort | uniq -c

awk '{print $1}' test.txt | sort | uniq -c

#统计第一列ip的个数
awk '{sum[$1]+=1} END {for(k in sum) print k ":" sum[k]}' ip.txt

#统计前三个ip出现次数最多的(k按第一列排序)
sort ip.txt | uniq -c | sort -nr -t ' ' -k 1 | head -n 3

#统计access.log ip数量前10个
awk '{sum[$1]++}END{for(ip in sum) print ip, sum[ip]}' access.log | sort -rn -k 2|head  -n 10
#ip数量大于2的(k按第二列排序)
awk '{sum[$1]++}END{for(ip in sum)if(sum[ip]>2) print ip, sum[ip]}' access.log | sort -rn -k 2
#统计状态码
awk '{sum[$6]++}END{for(status in sum)if(sum[status]>2300) print status, sum[status]}' access.log | sort -rn -k 2
#统计状态码为200的ip个数
awk '{if($6=="200")sum[$1,$6]++}END{for(ip_num in sum)print ip_num,sum[ip_num]}' access.log |sort -rn -k 2|head -5

最新文章

  1. iOS:GCD理解1(同步-异步、串行-并行)
  2. go http.Get请求 http.Post请求 http.PostForm请求 Client 超时设置
  3. prince2 证书有用吗
  4. IOS - socket 编程初体验
  5. C#学习7.31判断体重是否超标
  6. C语言中数组的几种输入
  7. Fragment中调用Activity的UI
  8. BZOJ2073: [POI2004]PRZ
  9. mysql procedure返回多数据集
  10. JavaScript高级程序设计51.pdf
  11. 《Linux内核修炼之道》 系列
  12. Overloads和Overrides在元属性继承上的特性
  13. 使用PPRevealSideViewController实现侧滑效果
  14. 设计模式--迪米特法则(Lod/LKP)
  15. POJ 2455 Secret Milking Machine(搜索-二分,网络流-最大流)
  16. MVC4数据注解和验证
  17. TensorFlow[1]:概念和简例
  18. bat脚本:Java一键编译(Javac java)
  19. 实现一个ordeeddict
  20. Ansible 脚本运行一次后,再次运行时出现报错情况,原因:ansible script 的格式不对,应改成Unix编码

热门文章

  1. js的异常处理 try catch
  2. Hbase表结构
  3. python列表命令
  4. img src防缓存
  5. Acwing P283 多边形 题解
  6. (尚006)Vue计算属性之set与get
  7. ELK实践
  8. 替罪羊树 ------ luogu P3369 【模板】普通平衡树(Treap/SBT)
  9. SQL 清理日志
  10. book-rev8