I don't recall when the recursive search '-R' command line switch was introduced in grep, but now I can't imagine life without it.
Its only problem is that if any directory in the recursion doesn't have a match for the filename wildcard, grep -R will stop and will fail to report the directories and files that do produce positive search results.
For example:
grep -R skeleton_app *.xml
Will report only
AndroidManifest.xml: <application android:label="@string/skeleton_app">
While:
grep -R skeleton_app *
Will report all:
AndroidManifest.xml: <application android:label="@string/skeleton_app">
Binary file bin/classes.dex matches
Binary file bin/com/example/android/skeletonapp/R$string.class matches
gen/com/example/android/skeletonapp/R.java: public static final int skeleton_app=0x7f050000;
res/values/strings.xml: <string name="skeleton_app">Understanding Intents</string>
My question: Is there a way to tell 'grep -R' not to stop on filename mismatch?
Try:
grep -R --include '*.xml' skeleton_app .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With