ITeye博客

grep使用多个查询条件--或

huyumin · 2015-06-16 10:12 · linux · 操作系统 · Markdown

grep 'usrquota|grpquota' /etc/fstab

LABEL=/1 / ext3 defaults,usrquota,grpquota 1 1 /dev/hda10 /mnt/test1 ext3 defaults,grpquota 1 3

上面的这个方法是从网上找的。活色的部分可以实现多个条件的或关系查询。

其他方法:

『1』使用多个 -e 参数 如: netstat -an | grep -E "ESTABLISHED|WAIT" 注意: netstat -an | grep -e EST -e WAIT 并列使用多个 -e参数可以实现或条件

『2』使用扩展 如: netstat -an | grep -E "ESTABLISHED|WAIT" 注意: 此处的 -E 是大写 ,匹配条件一定要加 引号

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。