grep使用
regex式搜尋檔案中的模式。 另請參閱:rg,regex。 更多資訊:https://www.gnu.org/software/grep/manual/grep.html。
grep "{{模式字串}}" {{路徑/至/檔案1 路徑/至/檔案2}}
regex 式):grep {{[-F|--fixed-strings]}} "{{字串}}" {{路徑/至/檔案}}
grep {{[-rI|--recursive --binary-files=without-match]}} "{{模式字串}}" {{路徑/至/目錄}}
grep {{--context|--before-context|--after-context}} 3 "{{模式字串}}" {{路徑/至/檔案}}
grep {{[-Hn|--with-filename --line-number]}} --color=always "{{模式字串}}" {{路徑/至/檔案}}
grep {{[-o|--only-matching]}} "{{模式字串}}" {{路徑/至/檔案}}
stdin (標準輸入)中讀取資料,不列印匹配模式的行:cat {{路徑/至/檔案}} | grep {{[-v|--invert-match]}} "{{模式字串}}"
regex 式(支援 ?、+、{}、() 和 |),不區分大小寫模式:grep {{[-Ei|--extended-regexp --ignore-case]}} "{{模式字串}}" {{路徑/至/檔案}}