Skip to content

Instantly share code, notes, and snippets.

@urodoz
Last active September 25, 2017 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save urodoz/a7fa6122e39be0fa4c7dbd3f4fcb66e7 to your computer and use it in GitHub Desktop.
Save urodoz/a7fa6122e39be0fa4c7dbd3f4fcb66e7 to your computer and use it in GitHub Desktop.
Bash script to extract emails from file
#!/bin/bash
#Usage: bash extract_emails.sh file.txt output.txt
perl -ne'if(/[\w\.\-\_]+@([\w\-\_]+\.)+[A-Za-z]{2,4}/g){print "$&\n"}' $1 | sort | uniq > $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment