文件名称:url_email.txt
文件内容:
this is a line of text contains,<email> #slynux@slynux.com.</email>
and email address,blog "http://www.google.com",test@yahoo.com
dfdfdfdddfdf;cool.hacks@gmail.com<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
slynux@slynux.com
test@yahoo.com
cool.hacks@gmail.com