grep正则IP匹配
以 361way-log 日志文件为例
1grep -o "[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]" 361way-log
2egrep -o "([0-9]{1,3}.){3}[0-9]" 361way-log
以上两个是过滤出具体的IP 来 ,如果想统计IP ,可以 加上 sort 和uniq 命令来统计 每个IP出现的次数并排序,下面的命令是过滤出含有IP的行,把该行现实出来
1grep -E "([0-9]{1,3}.){3}[0-9]" 361way-log
捐赠本站(Donate)
如您感觉文章有用,可扫码捐赠本站!(If the article useful, you can scan the QR code to donate))
- Author: shisekong
- Link: https://blog.361way.com/grep-rex-ip-address/3312.html
- License: This work is under a 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议. Kindly fulfill the requirements of the aforementioned License when adapting or creating a derivative of this work.