I have a large text file where the word DATA appears more than 10000 times. I would like to know how can a make a conditional substitution, so the first time it appears in the document it is changed to NO1 and the second time to NO2 and so on, using bash. I was thinking about some complicated script using bash but there must be an easier way, I guess.
perl -pe 's/DATA/ "NO" . ++$n /ge' file_in > file_out
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With