Command line utility to extract emails from a file. Usage sh extractemail.sh yourfile.csv
#!/usr/bin/env bash
if [ -f "$1" ]; then
grep -E -o "\b[a-zA-Z0-9.-._]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b" "$1" | uniq -i > "$1.txt"
else
echo "Expected a file at $1, but it doesn't exist." >&2
exit 1
fi