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

By Genevieve
at 2008-05-22T14:14
at 2008-05-22T14:14
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
--
: ※ 引述《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
--
Tags:
Linux
All Comments
Related Posts
grep 能同時過濾 2個條件嗎

By Ina
at 2008-05-21T17:15
at 2008-05-21T17:15
grep 能同時過濾 2個條件嗎

By Valerie
at 2008-05-21T16:46
at 2008-05-21T16:46
在NB上裝LINUX...

By Bennie
at 2008-05-21T16:36
at 2008-05-21T16:36
辦公室用途 請給建議

By Kristin
at 2008-05-21T15:13
at 2008-05-21T15:13
cpu使用率顯示不到10% 可是溫度很高...

By Tracy
at 2008-05-21T13:38
at 2008-05-21T13:38