Last active
August 20, 2020 22:26
-
-
Save donchan922/ee2393dc8579353ebbe50cc0d5f10498 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ find 検索対象のディレクトリ -name 検索対象のファイル -type f -print0 | xargs -0 grep 検索したい文字列 | |
# 例1. カレントディレクトリ配下の「foo*」ファイル内に「hoge」が含まれているものを検索する | |
$ find . -name 'foo*' -type f -print0 | xargs -0 grep hoge | |
# 例2. カレントディレクトリ配下の「.txt」ファイル内に「hoge」が含まれているものを検索する | |
$ find . -name '*.txt' -print0 | xargs -0 grep hoge | |
# 例3. /var/log配下のファイル内に「hoge」が含まれているものを検索する | |
$ find /var/log -type f -print0 | xargs -0 grep hoge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment