did you want to modify your current script to produce the desired output or write a new script to modify the output? Here is a
perl solution until you clarify your requirements:
Code:
perl -pe 'BEGIN {$i = 0;} print $i++, " ", s/,/ /g;' inputfile > outputfile