Skip to content

Instantly share code, notes, and snippets.

@lfreneda
Created January 27, 2016 18:31
Show Gist options
  • Save lfreneda/f2dc327af5d3d1513861 to your computer and use it in GitHub Desktop.
Save lfreneda/f2dc327af5d3d1513861 to your computer and use it in GitHub Desktop.
extract-emails.sh
#!/usr/bin/env bash
if [ -f "$1" ]; then
strings "$1" | grep -o '[[:alnum:]+\.\_\-]*@[[:alnum:]+\.\_\-]*' | sort | uniq -i > emails_"$1"
else
echo "Expected a file at $1, but it doesn't exist." >&2
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment