Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Find and grep does not work afaik because I need to create a list of files that satisfy EITHER requirement, not both. I assume this requires more than a one-liner. Any suggestions?

share|improve this question

It is possible with the following command:

comm  -3 <(find path -name '*string*' | sort) \
         <( grep -r 'string' path | sed s=^=./= | sort) 

You might need to change the sed part to make the paths reported by find and grep compatible. The -3 switch to comm suppresses printing the files that appear in both the lists.

share|improve this answer
Nice, thanks. Unfortunately, comm is not available in my version of Busybox. I know how to run each command, but how can I filter and combine and sort the results? – cdonner Mar 4 '14 at 18:14

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.