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
1 | root@k8s:~# cat 1.txt |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment