Skip to content

Instantly share code, notes, and snippets.

@wm wm/0_README.md
Last active Aug 29, 2015

Embed
What would you like to do?
Extract uniq emails sorted by domain from file.

Extract uniq emails sorted by domain from file.

Note that we ignore emails of the form xxx@yyy.com, i.e. if it has a '<' we ignore it.

Usage

$ extract_emails.zsh file_with_emails.txt
example@example.com
ex@ex.com
...
# Extract uniq emails sorted by domain from file.
# Note that we ignore emails of the form <xxx@yyy.com>, i.e. if it has a '<' we ignore it.
awk '{
for (i=1;i<=NF;i++) {
if ( $i ~ /[[:alpha:]]@[[:alpha:]]/ ) {
print $i
}
}
}' $1 | sort | uniq | grep -v '<' | sort -t@ -k2 -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.