How do I traverse the filesystem looking for a regex match?

Posted by editor on Server Fault See other posts from Server Fault or by editor
Published on 2010-06-14T21:05:29Z Indexed on 2010/06/14 21:13 UTC
Read the original article Hit count: 137

Filed under:

I know this is teeball for veteran sysadmins, but I'm looking to search a directory tree for file contents that match a regex (here, the word "Keyword"). I've gotten that far, but now I'm having trouble ignoring files in a hidden (.svn) file tree.

Here's what I'm working with:

find . -exec grep "Keyword" '{}' \; -print

Reading sites via search I know that I need to negate the name flag, but I can't it working in the right order.

© Server Fault or respective owner

Related posts about sysadmin