egrep 用法示例

文件名称:url_email.txt

文件内容:


this is a line of text contains,<email> #[email protected].</email>
and email address,blog "http://www.google.com",[email protected]
dfdfdfdddfdf;[email protected]<br/>
<ahref="http://code.google.com"><h1>Heading</h1>

 

用法实例:

http url的egrep正则表达式:http://[a-zA-Z0-9.]+\.[a-zA-Z]{2,3}
[zhang@zhangshibo temp]# egrep -o "http://[a-zA-Z0-9.]+\.[a-zA-Z]{2,3}" url_email.txt
http://www.google.com
http://code.google.com

 

Email的egrep正则表达式:[A-Za-z0-9.]+@[A-Za-z0-9.]+\.[a-zA-A]{2,4}
[zhang@zhangshibo temp]# egrep -o '[A-Za-z0-9.]+@[A-Za-z0-9.]+\.[a-zA-A]{2,4}' url_email.txt
[email protected]
[email protected]
[email protected]



 

你可能感兴趣的:(正则表达式,Blog,url,email)