reading a file line by line and appending into a variable with semicolon in between

Viewed 26

I have a .txt file containing mail addresses like

a@xyz.com  
b@xyz.com  
c@xyz.com

I need to pass a variable which contains values for eg

$MAIL_ID=a@xyz.com;b@xyz.com;c@xyz.com;

I came up with something like

cat mail_list.txt | for MAIL_ID in $(cat ${1});
do
TEMP=' '
$ID=$MAIL_ID";"$TEMP
done
echo $ID

pls help with this

3 Answers
Related