Extract e-mail addresses from large text file [closed]
#!/bin/bash
Report=/Users/me/Desktop/mail/cur.txt
for f in /Users/me/Desktop/mail/test/*; do
if [ -f "$f" ] ; then
EMAIL=$(/usr/bin/grep -E -o '([a-zA-Z0-9_\.-]+)@([a-zA-Z0-9_\.-]+)\.([a-zA-Z]{2,5})' "$f" )
if [ "$EMAIL" != "" ] ; then
echo "$EMAIL" >> "$Report"
fi
fi
done