grep
使用正則表達式在文件中查找字符串。 更多資訊:https://www.gnu.org/software/grep/manual/grep.html.
grep "{{字符串}}" {{檔案/完整/路徑}}
grep {{[-F|--fixed-strings]}} "{{精確字符串}}" {{檔案/完整/路徑}}
grep {{[-r|--recursive]}} {{[-n|--line-number]}} --binary-files {{without-match}} "{{字符串}}" {{檔案/完整/路徑}}
?
, +
, {}
, ()
, 和 |
),並啟用不區分大小寫的模式:grep {{[-E|--extended-regexp]}} {{[-i|--ignore-case]}} "{{字符串}}" {{檔案/完整/路徑}}
grep --{{context|before-context|after-context}} 3 "{{字符串}}" {{檔案/完整/路徑}}
grep {{[-H|--with-filename]}} {{[-n|--line-number]}} --color=always "{{字符串}}" {{檔案/完整/路徑}}
grep {{[-o|--only-matching]}} "{{字符串}}" {{檔案/完整/路徑}}
cat {{檔案/完整/路徑}} | grep {{[-v|--invert-match]}} "{{字符串}}"