linux三劍客之grep
阿新 • • 發佈:2020-10-19
Matching Control
-i :Ignore case 忽略大小寫
-w:whole words 按照整個單詞匹配
-v:Invert the sense of matching, to select non-matching lines 匹配不包含指定關鍵字的行
Output Line Prefix Control
-n:line number 在行前顯示行號
Context Line Control
-A NUM:Print NUM lines of trailing context after matching lines. 顯示關鍵字所在行的後NUM行
-B NUM:Print NUM lines of leading context before matching lines. 顯示關鍵字所在行的前NUM行
-C NUM:Print NUM lines of output context 顯示關鍵字前後NUM行
General Output Control
-c :print a count of matching lines 列印匹配關鍵在所在行的個數