grep 能同時過濾 2個條件嗎 - Linux

Table of Contents

※ 引述《demintree (Mirabelli's back in tow)》之銘言:
: ※ 引述《cotix (Feb 14, 2007)》之銘言:
: : 我想要用grep 指令,同時過濾「兩個條件」
: : 比如說,我想抓出一行中,同時有提到 sta1 與 sta2 字眼,
: : 但找了很久, 似乎文件都只提到單一條件
: : 請問我的要求,grep可以滿足嗎...
: 你把grep的結果pipe給後面的grep不就滿足了嗎?
: for example
: ls -al|grep sta1|grep sta2
你可以用-f 讀取特定條件擋
ex: grep -f filename 'target file'
檔案中再填入你要搜尋的key words

--

All Comments