while IFS=, read -r col1 col2 col3
do
email="$col3"
email+='@gmail.com'
echo $email
done < ~/Desktop/Names.csv
I don't have to do anything special with Column 1 or 2, but adding @gmail.com to column 3 just outputs @gmail.com or if the input string is longer @gmail.com+longer bit of input string.
ie.
If column 3 was Dekkars, I get @gmail.com. If it is aaaaaaaaaaa (one length longer than @gmail.com) I get @gmail.coma
I'm sure this is something to do with the @ sign, but I've tried using \ to escape it, single quotes, etc. Any ideas?
I've already read concatenating bash strings, and I'm doing what it suggests with different outcomes than are expected.
Here is input Data
Test Name,8,aaaaaaaaaaa
John Doe,8,bbbbbbbbbbbb
Name,Grade,ID
(Note, I have columns at bottom because otherwise my while loop won't read the bottom row)
Output
@gmail.coma
@gmail.combb