I have a file to which I would like to add line numbers selectively. Say the target string begins with INIT "command" where command is a variable text string. I want it to be INIT "linenumber command". The idea is that each INIT line is tagged with a unique id ordered but not necessarily contiguous. That unique id could be its line number. Bonuses (virtually of course!) if the number could be in hex.
EDIT:
Sample input
#: ../src/app-utils/business-prefs.scm:24
msgid "Counters"
msgstr ""
Sample output
#: ../src/app-utils/business-prefs.scm:24
msgid "123f>Counters"
msgstr "123f>شمارندهها"
The file is filled with thousands of these msg couples. The msgid and msgstr tags match thus have to have a same code. With the code below I would run it twice and change the inside parameter. I think I have to change some numbers in the code to adapt it for the sample. I have added ">" just to make it easier to recognize the code from the actual string i.e. some beautification.