Franklin's approach looks better and working well for me.
There might be some problem in your script. Please post your script printing each line twice.
Thanks everyone. I tried Franklin's approach and it is working fine. Now my question is how to get the value from 3rd column. I suppose Franklin's script will only work if there 2 columns. But I also need to get the value from 3rd column. Please help me on this.
@lakris. Do not forget to save IFS in a variable so it can be restored to its original value afterwards.
There is another possibility:
while IFS=, read id name attr x
do
echo "$id"
echo "$name"
echo "$attr"
done < temp.txt
With this construct IFS does not need to be restored afterwards. (I included an extra variable (x), because I suspect the OP may have a line with even more fields...)