grep

使用正則表達式在文件中查找字符串。 更多資訊:https://www.gnu.org/software/grep/manual/grep.html.

grep "{{字符串}}" {{檔案/完整/路徑}}

grep {{[-F|--fixed-strings]}} "{{精確字符串}}" {{檔案/完整/路徑}}

grep {{[-rnI|--recursive --line-number --binary-files=without-match]}} "{{字符串}}" {{檔案/完整/路徑}}

grep {{[-Ei|--extended-regexp --ignore-case]}} "{{字符串}}" {{檔案/完整/路徑}}

grep {{--context|--before-context|--after-context}} 3 "{{字符串}}" {{檔案/完整/路徑}}

grep {{[-Hn|--with-filename --line-number]}} --color=always "{{字符串}}" {{檔案/完整/路徑}}

grep {{[-o|--only-matching]}} "{{字符串}}" {{檔案/完整/路徑}}

cat {{檔案/完整/路徑}} | grep {{[-v|--invert-match]}} "{{字符串}}"