in reply to Re-ordering data in data file
This is the basic idea of what I'd do:
...or, from the command linemy $count = 0; while (<IN>) { s/^"\d+"$/'"' . ++$count . '"'/e; print OUT; }
The one-liner puts the original file in myfile.bak.% perl -i.bak -pe 's/^"\d+"$/q(").++$count.q(")/e' myfile
the lowliest monk
|
|---|