linux命令筛选出ipv4地址并去重计算出现次数
sticky | Created | Updated | shell | shell | comments linux命令筛选出ipv4地址并去重计算出现次数 代码如下: grep -oE “\b([0-9]{1,3}.){3}[0-9]{1,3}\b” 1.txt |sort -nr |uniq -c ss -ant |grep ESTAB |awk -F ‘[ :]+’ ‘{print $4}’ |grep -v ‘[‘ |sort -rn |uniq -c cat 1.txt |awk -F ‘[ :]+’ ‘/^ip/{print $2}’ |sort -nr |uniq -c 12345678910111213141516171819202122root@k8s:~# cat 1.txt ip: 10.10.10.1:1080ip: 10.10.10.2:1080ip: 10.10.10.4:2050ip: 10.10.10.2:1020root@k8s:~# ss -ant |grep -oE "\b([0-9]{1,3}\.){3 ...