比如有如下文件test.txt
1 134.102.173.43
2 134.102.173.43
3 134.102.171.42
4 134.102.170.9
要统计出现次数最多的IP可以利用以下shell脚本:
cat test.txt | awk '{print $2}' | sort | uniq -c | sort -n -r | head -n 1
比如有如下文件test.txt
1 134.102.173.43
2 134.102.173.43
3 134.102.171.42
4 134.102.170.9
要统计出现次数最多的IP可以利用以下shell脚本:
cat test.txt | awk '{print $2}' | sort | uniq -c | sort -n -r | head -n 1
转载于:https://www.cnblogs.com/zjfdlut/p/3951253.html