'grep -R string *.txt' even when top dir doesn't have a .txt file -


i don't recall when recursive search '-r' command line switch introduced in grep, can't imagine life without it.

its problem if directory in recursion doesn't have match filename wildcard, grep -r stop , fail report directories , files produce positive search results.

for example:

  grep -r skeleton_app *.xml 

will report

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: there way tell 'grep -r' not stop on filename mismatch?

try:

grep -r --include '*.xml' skeleton_app . 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -