Created
April 4, 2012 18:50
-
-
Save EnriqueVidal/2304702 to your computer and use it in GitHub Desktop.
Extract emails from files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function email_extract { | |
if [ -z "$1" -o -z "$2" ]; then | |
echo usage: email_extract path file | |
echo example: email_extract . *.php | |
return 1 | |
fi | |
find $1 -iname $2 -exec perl -wne'while(/[\w\.]+@[\w\.\-]+\w+/g){print "$&\n"}' {} \; | |
} | |
email_extract $1 $2 | |
#vim: set ft=sh |
Actually don't use this, use ack ack -i '[\w\.]+@[\w\.\-]+[a-z]{2,3}+' -o --no-filename | sort | uniq
or rewrite it and make it ignore comments.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just give it execution permission and put it somewhere in your
$PATH