首页 > 其他 > 详细

grep 匹配的几个参数

时间:2015-03-02 21:01:10      阅读:311      评论:0      收藏:0      [点我收藏+]

grep -o

grep 忽略匹配自己 ps aux | grep python 总是会看到一个包含grep的匹配项,这是不符合我们的匹配期望的。可以这样过滤掉grep这个匹配项。可以用下面这个命令来实现

ps aux | grep python | grep -v grep

grep -F

grep -F 等价于 fgrep。 egrep 等价于 grep -E。
下面是找到的资料

You have a file with a list of say ten Unix usernames in plain text. You want to search the group file on your machine to see if any of the ten users listed are in any special groups:

grep -F -f user_list.txt /etc/group

The reason the -F switch helps here is that the usernames in your pattern file are interpreted as plain text strings. Dots for example would be interpreted as dots rather than wild-cards. -f 表示内容从 user_list.txt 中读取。

grep -o

grep -o 输出匹配的内容。

grep -E

支持扩展的正则表达式。

grep 匹配的几个参数

原文:http://blog.csdn.net/typeof_/article/details/44014619

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