首页 > 系统服务 > 详细

shell过滤特定内容

时间:2014-12-08 15:44:28      阅读:377      评论:0      收藏:0      [点我收藏+]

过滤文件内电子邮箱和网站地址

过滤邮箱(只显示过滤文本):

#egrep -o ‘[A-Za-z0-9.]+@[A-Za-z0-9.]+\.[a-zA-Z]{2,3}‘ file.txt

zhangsan@sina.com

lishi.123@sohu.com


过滤网站地址:

#egrep -o ‘http://[A-Za-z0-9\-\.]+\.[a-zA-Z]{2,3}‘ file.txt

http://code.nagios.google.com

http://www.baidu.com


过滤IP地址:

egrep -o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" file.txt


本文出自 “always_yunwei” 博客,请务必保留此出处http://alwaysyunwei.blog.51cto.com/3224143/1587555

shell过滤特定内容

原文:http://alwaysyunwei.blog.51cto.com/3224143/1587555

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!