msgbartop
A cronological documentation test project, nothing serious, really!
msgbarbottom

01 Nov 07 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: , ,

Leave a Comment

You must be logged in to post a comment.