Skip to content

Instantly share code, notes, and snippets.

@akhld
Created December 1, 2018 12:37
Show Gist options
  • Save akhld/05e768387513d8035753d3410cc63971 to your computer and use it in GitHub Desktop.
Save akhld/05e768387513d8035753d3410cc63971 to your computer and use it in GitHub Desktop.
Email scrapper
cat urls | while read url;
do
curl -o- $url | grep -oh -i '[A-Z0-9._%+-]\+@[A-Z0-9.-]\+\.[A-Z]\{2,4\}' > emails;
email_found=`[[ $(wc -l < emails) -ge 1 ]] && echo "yes" || echo "no"`;
emails=`head -n3 emails | perl -00 -lpe 's/\n/,/g'`;
domain=`echo $url | awk -F[/:] '{print $4}'`;
more_emails=`[[ $(wc -l < emails) -ge 3 ]] && echo "yes" || echo "no"`;
echo "$domain, $email_found, $emails, $more_emails, $url";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment