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.

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

1 Answer

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

Your Answer

 
discard

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.