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

推荐方法

| 符号法

[root@mail ~]# grep 'usrquota|grpquota' /etc/fstab

其他方法

『1』使用多个 -e 参数

如:

netstat -an | grep -E "ESTABLISHED|WAIT"

注意:

netstat -an | grep -e EST -e WAIT

并列使用多个 -e参数可以实现或条件

『2』使用扩展 -E

netstat -an | grep -E "ESTABLISHED|WAIT"

此处的 -E 是大写 ,匹配条件一定要加 引号

原文地址:https://www.cnblogs.com/jjzd/p/6220476.html