Read variables contain spaces from text file

Dears,

I developed a shell script to read varibales from text file as the following:

cat /dev/null > /rename-OUT.txt
while read line
do
set -- `echo $line`
snmpset -c dslmibs $1 sysName.0 octetstring $2
after=$(snmpget -c dslmibs $1 sysName.0 | cut -d: -f3)
echo "$1,$2,$after" >> /rename-OUT.txt
done < /list.txt

It worked fine when variables don't have spaces but when the variable has spaces however I put it between double quotation " ", it didn't work.

"list.txt" example:
172.16.31.242 "HELWAN-R01C-C-EG L1 1GE"

It consider only the part "HELWAN-R01C-C-EG is the second variable but the desired is HELWAN-R01C-C-EG L1 1GE

Please help me.

The echo statment is losing your variables for you.

> /rename-OUT.txt
while read line
do
  set -- $line
  snmpset -c dslmibs $1 sysName.0 octetstring $2
  after=$(snmpget -c dslmibs $1 sysName.0 | cut -d: -f3)
  echo "$1,$2,$after" 
done < /list.txt  > /rename-OUT.txt