Friday, April 15, 2011

Grepping for email addresses

I needed to make sure we didn't have any test emails in use on a recent project. This came in handy:

grep -srhw --exclude=*.{jpg,jpeg,gif,png} "[[:alnum:]]\+@[[:alnum:]]\+" .

I'm aware regex email searching is actually more complex than this, but this regex worked well in this instance.