shell的正则匹配IP
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[root@master ~]
# cat test.txt
2014-08-17
20140907
14 03 22
aa.aa.bb.cc
af.23.67.90
ffffff
oo.09.0f.87.90
192.168.1.2
121.168.2.3
0987238349
999.999.99.999
123-212-2-3
|
用grep
1
2
3
|
[root@master ~]
# egrep "((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" test.txt
192.168.1.2
121.168.2.3
|
本文转自 Forande 51CTO博客,原文链接:http://blog.51cto.com/853056088/2060330