Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

You must log in to answer this question.