Using grep to find all emails

Posted by AntonAL on Stack Overflow See other posts from Stack Overflow or by AntonAL
Published on 2010-05-24T16:24:01Z Indexed on 2010/05/24 16:31 UTC
Read the original article Hit count: 207

Filed under:
|

Hi, How to properly construct regular expression for "grep" linux program, to find all email in, say /etc directory ? Currently, my script is following:

grep -srhw "[[:alnum:]]*@[[:alnum:]]*" /etc

It working OK - a see some of the emails, but when i modify it, to catch the one-or-more charactes before- and after the "@" sign ...

grep -srhw "[[:alnum:]]+@[[:alnum:]]+" /etc

.. it stops working at all

Also, it does't catches emails of form "[email protected]"

Help !

© Stack Overflow or respective owner

Related posts about linux

Related posts about grep