作者:2010级嵌入式 张坤
[root@localhost 桌面]# cat aaa.txt
192.168.1.1
1234.234.04.08
123.1234.045.678
asdfasdf127.0.0.1asdfsadf
0.0.0.0
255.255.0.0
非法ip: 256.0.0.256
abcde
+++++++++++++++++++++++++++++++++++++++++
[root@localhost 桌面]# egrep '([^0-9]|\<)(([0-1]?[0-9]{0,2}|([2]([0-4][0-9]|[5][0-5])))\.){3}([0-1]?[0-9]{0,2}|([2]([0-4][0-9]|[5][0-5])))([^0-9]|\>)' aaa.txt
192.168.1.1
asdfasdf127.0.0.1asdfsadf
0.0.0.0
255.255.0.0
[root@localhost 桌面]#
阅读(1103) | 评论(0) | 转发(0) |