---
title: "grep使用多个查询条件－－或"
author: "huyumin"
date: "2015-06-16T10:12:35Z"
tags: []
categories: ["操作系统"]
slug: "grep"
draft: false
lastmod: "2015-06-16T10:12:35Z"
id: 2219954
url: "https://huyumin.iteye.com/blog/2219954"
---

# 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 是大写 ，匹配条件一定要加 引号