Reputation: 943
I am looking for a way to find all "info.plist"-files that contain "iphonesimulator" in my directory and all subdirectories.
I know that I can find all "iphonesimulator" via:
grep -ri "iphonesimulator" .
But that is not everything that I want. Is there a way to also filter for files? I tried with -f but that does not work.
Upvotes: 0
Views: 1473
Reputation: 810
You can use the following:
find <root_directory> -name '<file_matching_pattern>' -exec cat {} \; -exec grep --colour -i 'text_matching_pattern' {} \;
For your particular example:
find / -name info.plist -exec cat {} \; -exec grep --colour -i '*iphonesimulator*' {} \;
or you can just ignore file name pattern and do it like this
Upvotes: 1