1、统计访问ip个数,并根据访问量由大到小排序
数据:http://192.168.200.10/index1.htmlhttp://192.168.200.20/index1.htmlhttp://192.168.200.20/index2.htmlhttp://192.168.200.30/index2.htmlhttp://192.168.200.10/index1.htmlhttp://192.168.200.10/index2.html命令:cat data.txt | cut -d '/' -f 3 | sort | uniq -c |sort -nr解释:cat 文件名 | 根据'/'进行切分取第三部分的数据 | 需要先排序一下 | 统计元素出现次数 | 再由大到小排序返回:3 192.168.200.102 192.168.200.201 192.168.200.30
2、统计当前linux服务器连接的ip并根据并发数由大到小排序
命令:netstat -an | grep ESTABLISHED | awk -F " " '{print $5}' | cut -d ":" -f 1 | sort | uniq -c解释:获取当前所有网络连接 | 过滤正在连接的 | 根据" "进行分割取第5个元素 | 再使用cut分割,也可以使用awk分割 | 排序 | 统计
3、
