I want to search a text file for strings like these.
[task0] [task1] ... [task1613]
and increment each by a given offset, in this case by 3640. So, with the example I gave above, I'd get the following.
[task3640] [task3641] ... [task5253]
I want each of the incremented numbers in their original positions in the target file though,
[task#] wrapped around the number. Using
sed "/^\[task/s/[0-9]*\]/3640+&/" ./test.file2
I can get something like:
[task3640+0] [task3640+1] ... [task3640+1614]
but that isn't very useful because I don't know how to evaluate the expressions in place and
I'm fairly sure that
sed isn't suited for this.
I'm thinking that
perl would work better for this, but I'm fairly inept at both of them.
Can someone at least point me in the right direction, please? I've spent way longer than I want to admit on this already.
For a more detailed view of what I want to do see this page on pastebin.