I have a long text file that I want to mostly remain the same, but certain phrases need translated. It's not exactly a clean search-and-replace... For example, I need to change each occurrence of this...
lis r3, ha16(aLabel)
...into this:
lis r3, aLabel@ha
I.e. I need to find the whole ha16(aLabel)
, capture the aLabel
from it (which could be any identifier text up to the terminating end-paren), and then emit a replacement of the captured text followed by @ha
.
I've found examples galore of perl search-and-replace, but I haven't come across anything quite like what I need, and other posts that mention 'perl' and 'capture' don't seem to address my problem... or maybe they do and I'm too stupid to realize it.