Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

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

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

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

3 Answers 3

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

you can just use grep if it has -R option

grep -R -l "string" * 2>/dev/null
share|improve this answer
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.