张坤 2012.5.4 egrep在文件中找IP地址
                                            作者: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 桌面]#
            
            
              
            
          
          
            
		  
        
      
      
		
        		
		
        
                                              
[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 桌面]#
			  
			  
				
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
				
			  
              阅读(528) | 评论(0) | 转发(5) |
			                
            相关热门文章
			            
          给主人留下些什么吧!~~
				
				
		评论热议
 
                    
                
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号