0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

grepコマンドで複数条件を指定して検索する(AND検索、OR検索)

Last updated at Posted at 2024-10-23

(自身の備忘録用です)

任意の対象に対して、AND検索

grep <grepしたい文字列> <対象(ファイル名)> | grep <grepしたい文字列>
ex: grep test test.txt | grep hoge

任意の対象に対して、OR検索

①
grep -e <grepしたい文字列> -e <grepしたい文字列> <対象(ファイル名)>
ex: grep -e test -e hoge test.txt

②
egrep "<文字列|文字列>" <対象(ファイル名)>
ex: egrep "test|hoge" test.txt
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?