Recursive text search with grep and file patterns

Posted by Anders Sandvig on Server Fault See other posts from Server Fault or by Anders Sandvig
Published on 2009-05-19T11:38:09Z Indexed on 2010/05/03 16:58 UTC
Read the original article Hit count: 198

Given this example folder structure:

/folder1/file1.txt
/folder1/file2.djd
/folder2/file3.txt
/folder2/file2.fha

How do I do a recursive text search on all *.txt files with grep from "/"?

("grep -r <pattern> *.txt" fails when run from "/", since there are no .txt files in that folder.)

© Server Fault or respective owner

Related posts about grep

Related posts about text-search