grep -v 反选匹配内容(not操作)以及grep -E(or操作)

grep not操作

使用 grep -v 可以实现反向选择操作

如:筛选出test.txt文本中不包含匹配内容的行

grep or操作

1、使用 grep -E 可以实现or操作(也可以写成egrep)

如:筛选出test.txt文本中包含“a”或“b”的行

2、使用\| 也可以实现or操作

用例:grep "a\|b" test.txt

posted @ 2020-04-27 17:50  月夜星光  阅读(5726)  评论(0编辑  收藏  举报