DISQUS

DISQUS Hello! Tech-Recipes is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

Tech-Recipes

Cookbook of Tech Tutorials
Jump to original thread »
Author

Recursive grep | UNIX | Tech-Recipes

Started by qdideas · 9 months ago

No excerpt available. Jump to website »

8 comments

  • Thank you so much,

    It is one of those days.. I spent almost an hour for this.....

    Best, peace...
    Hal
  • that's great and all, but you dont get filenames
  • find . -name "*" -exec grep <pattern> {} /dev/null ;
  • find /users/ -type f -name "*" -exec grep -ls sqlload {} ;
    It gives output like this:
    /users/hattb/shirley_test_file

    The -type f switch tells it to only look in text files.
    If you want to redirect the output to a file:
    find /users/hattb -type f -name "*" -exec grep -ls sqlload {} ; >out.txt

    Hope this helps,
    Shirley
  • It's so great. Thanks.
  • find|xargs grep 'search text'

    is easier to type :-)

    xargs rocks.
  • For those of you with a really stripped down config with no xargs and a find that doesn't support -exec, the old fashioned way:

    for i in `find <path>`; do grep <pattern> $i; done
  • This is a fantastic tip, thank you!

Add New Comment

Returning? Login