Extract email addresses from text files AKA Maildir

This script is great... for extracting emails from text files...

#!/usr/bin/env bash
FILES=*
for f in $FILES
do
  # echo "Processing $f file..."
  # take action on each file. $f store current file name
  # cat $f
 grep -o '[[:alnum:]+\.\_\-]*@[[:alnum:]+\.\_\-]*' "$f" | sort | uniq -i
done

cd /home/dir/homes/user/Maildir
vi emails.sh <-(put script here)
cd cur
../emails.sh | more (take a preview)
../emails.sh > /home/dir/email_addys.txt (save extracted emails to file)

 

Comments   

0 #1 Emailguy 2020-05-19 21:29
Thanks! that made my work easy!!
Quote

Add comment


Security code
Refresh