I have to files. One is Emails.csv and the other is a list of names. I need to append names to email addresses containing that name. My problem is that some lines will already have the desired name1234@domain.com,name
I need. How do I make appention (is that a word? It must be...) conditional?
#!/bin/bash
while read n; do
egrep -i "$n" Emails.csv
if [ -z '"$n" | cut -d"," -f2' ]; then
sed -i "s/$/,$n/" Emails.csv
fi
done < names.txt
As my script is now, it just spits the content of Emails.csv. I need a solution in Bash. Sorry if this was answered elsewhere, I just couldn't find a similar question.
Aucun commentaire:
Enregistrer un commentaire