正規表現を使ってファイルのパターンを見つけます。 もっと詳しく: https://www.gnu.org/software/grep/manual/grep.html。
grep "{{検索パターン}}" {{path/to/file}}
grep {{-F|--fixed-strings}} "{{正確な文字列}}" {{path/to/file}}
grep {{-r|--recursive}} {{-n|--line-number}} --binary-files {{without-match}} "{{検索パターン}}" {{path/to/directory}}
?
, +
, {}
, ()
, |
をサポート)を大文字小文字を区別しないモードで使用する:grep {{-E|--extended-regexp}} {{-i|--ignore-case}} "{{検索パターン}}" {{path/to/file}}
grep --{{context|before-context|after-context}} 3 "{{検索パターン}}" {{path/to/file}}
grep {{-H|--with-filename}} {{-n|--line-number}} --color=always "{{検索パターン}}" {{path/to/file}}
grep {{-o|--only-matching}} "{{検索パターン}}" {{path/to/file}}
stdin
から検索する:cat {{path/to/file}} | grep {{-v|--invert-match}} "{{検索パターン}}"