it lists all files in "." that contain the string "string" but don't show dirs with permission denied.

What would it be the equivalent of that but squeezing xargs in between?

link|improve this question
1  
Why do you want xargs inbetween? – Andrew Bolster Apr 7 '10 at 2:48
@Closers: Shell scripting is programming; this could easily be more appropriate for SO than SU (it depends on other details the OP has not yet provided). – Roger Pate Apr 8 '10 at 7:27
feedback

migrated from stackoverflow.com Apr 8 '10 at 22:47

This question came from our site for professional and enthusiast programmers.

3 Answers

find . -readable | xargs grep -l 'string'
link|improve this answer
feedback

you can just use grep if it has -R option

grep -R -l "string" * 2>/dev/null
link|improve this answer
feedback
find . -type f -print0 | xargs -0 grep -l 'string'

This handles names with blanks (etc) in the file names - and assumes you are using GNU find and xargs.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown