Feed on

i was always too dumb to get the “-R” option of grep working correctly so that i could apply grep recursively.  finally, i came across a simple workaround that uses find and xargs:

find ./ -name “*.py” | xargs grep “my_pattern”

Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

One Response to “apply grep recursively”

  1. on 28 Nov 2008 at 12:06 pm Jorge

    You can also type
    find ./ -name “*.py” -exec grep “my_pattern” -H {} \;

Did I get this wrong? Let me know!

Trackback URI | Comments RSS