I have a bunch of files containing the same log message. One of them happens, but since the messages are identical, I donβt know which one. What I want to do is add a number after all these messages to distinguish them.
Now that I have a bunch search and a replacement to execute, I just write a quick single-line perl, for example:
perl -pi -e 's/searched/replacement/g' *.c
But how can I insert a counter in replacements?
kriss source
share