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.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.