in reply to Re-ordering data in data file

This is the basic idea of what I'd do:

my $count = 0; while (<IN>) { s/^"\d+"$/'"' . ++$count . '"'/e; print OUT; }
...or, from the command line
% perl -i.bak -pe 's/^"\d+"$/q(").++$count.q(")/e' myfile
The one-liner puts the original file in myfile.bak.

the lowliest monk