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

I have a list of values, and I need find each value one by one in a folder (and its sub-folders) with files, and then save the results (list of files for each entry). Is there any tools to do this? Windows is preferred, but Linux is ok too.

share|improve this question
grep -l value folder folder/* > results_for_value.txt

or, if "sub-folders" means to any depth

find folder -exec grep -l value {} \; > results_for_value.txt

but perhaps you want to read the man page for locate

locate value …
share|improve this answer
One could obviously wrap this in a while read value … ; do (your grep stuff) ; done < file_with_values.txt. – slhck Sep 21 '11 at 14:19

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.