|
|
Find is unnecessary, use grep -r
You don't need to use find at all in this example. grep -r can recursively search folders all by itself.
grep -r -i -l -q "stuff to find" /path/to/dir_to_search | xargs open
-r recursively search all directories -i case insensitive searching -l just list the filenames that match -q stop searching the file after the first match (faster) Note: be careful with your search pattern stuff to find as open could launch many many files. You can also shorten it to: grep -rilq "stuff to find" /path/to/dir | xargs open
Find is unnecessary, use grep -r
Two reasons why I like the original command better:
Find is unnecessary, use grep -r
Tip: instead of
find -print | xargs, use find -print0 | xargs -0; then blanks and special characters are not a problem.
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.09 seconds |
|