How can I add consecutive numbers to a string in a text file, with two strings each having the same number?
example:
id="picture-"
id="picture-"
id="picture-"
id="picture-"
...
result:
id="picture-1"
id="picture-1"
id="picture-2"
id="picture-2"
...
The number is not at the last position in the lines. I have tried this:
perl -pe 's/picture\-/$& . ++$n/ge' index.txt
But this adds the numbers so, that every string gets another number.
Any help would be appreciated.
zoid=foooracid=base? What if you have "picture" text that's elsewhere? Would it - should it - throw off the numbering?