A chronological documentation test project, nothing serious, really!

01 Nov 2007 Grep recursively through subdirectories

Posted by

grep recursively through subdirectories for files that match a specific pattern:

grep -l -r –include=*.doc regex *

The equivalent command unsing find:

find . -name ‘*.doc’ -exec grep -l regex \{\} \;

The option after grep is the lowercase letter L, not the number 1).
Remove the -l to see the actual matches instead of the file names.

Tags: , ,

Comments are closed.