Grep 如何对多个字符串同时使用-v选项

Grep 如何对多个字符串同时使用-v选项,grep,Grep,如何避免像这样多次输入-v: $ grep -v "^STAT" input.txt |grep -v "^FETCH" |grep -v "^EXEC" |more grep-v“^STAT”^FETCH“^EXEC”不起作用 input.txt内容 PARSING IN CURSOR #140624649413384 len=138 dep=1 uid=0 oct=47 lid=0 tim=2842971047106 hv=1640808739 ad='847b34d8' sqlid='3

如何避免像这样多次输入-v:

$ grep -v "^STAT" input.txt |grep -v "^FETCH" |grep -v "^EXEC" |more
grep-v“^STAT”^FETCH“^EXEC”不起作用

input.txt内容

PARSING IN CURSOR #140624649413384 len=138 dep=1 uid=0 oct=47 lid=0 tim=2842971047106 hv=1640808739 ad='847b34d8' sqlid='33kmw45hwth93'
end if;
end;
END OF STMT
EXEC #140624649413384:c=938,e=1085,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=4,plh=0,tim=2842971047105
CLOSE #140624649413384:c=17,e=16,dep=1,type=1,tim=2842971047215
STAT #140624649392392 id=1 cnt=0 pid=0 pos=1 obj=0 op='UPDATE  USER$ (cr=2 pr=0 pw=0 time=418 us)'
EXEC #140624649361984:c=43,e=43,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=2529664852,tim=2842971056023
FETCH #140624649361984:c=162,e=162,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=4,plh=2529664852,tim=2842971056204
STAT #140624649392392 id=2 cnt=1 pid=1 pos=1 obj=1332839 op='TABLE ACCESS CLUSTER USER$ (cr=2 pr=0 pw=0 time=15 us cost=1 size=7 card=1)'
WAIT #0: nam='library cache lock' ela= 156 handle address=1880771256 lock address=6417871272 100*mode+namespace=8323075 obj#=384 tim=2842971047466

我更喜欢使用grep,因为它比awk/sed等更容易

来自
曼格瑞普

SYNOPSIS
       grep [OPTIONS] PATTERN [FILE...]
       grep [OPTIONS] [-e PATTERN]...  [-f FILE]...  [FILE...]
我建议:

grep -v -e "^STAT" -e "^FETCH" -e "^EXEC" input.txt | more

man grep

SYNOPSIS
       grep [OPTIONS] PATTERN [FILE...]
       grep [OPTIONS] [-e PATTERN]...  [-f FILE]...  [FILE...]
我建议:

grep -v -e "^STAT" -e "^FETCH" -e "^EXEC" input.txt | more
分别

grep -E -v "(STAT|FETCH|EXEC)" input.txt
分别

grep -E -v "(STAT|FETCH|EXEC)" input.txt
grep-E-v“^(STAT | word2 |…| wordN)”文件
grep-E-v“^(STAT | word2 |…| wordN)”文件