Skip to content

Instantly share code, notes, and snippets.

@zkylab
Created December 7, 2020 20:40
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 zkylab/08f379d3811fe1d6987a14eddf112989 to your computer and use it in GitHub Desktop.
Save zkylab/08f379d3811fe1d6987a14eddf112989 to your computer and use it in GitHub Desktop.
# mails_raw.txt ==> Ken Thomson 555 1234567 ken0[at]thomson.com ... etc.
input="mails_raw.txt"
regex="(\w{1,})\[at\](\w{1,}\.\w{1,})"
while IFS= read -r line
do
while [[ $line =~ $regex ]]; do
echo "${BASH_REMATCH[1]}@${BASH_REMATCH[2]}" >> mail.txt
line=${line#*"${BASH_REMATCH[1]}"}
done
done < "$input"
input="mail.txt"
while IFS= read -r line
do
echo $line
echo “İyi sınavlar!” | mail -s “Sınav” $line
done < "$input"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment