sed: search and replace string with line number
- by tigerstyle
Hi volks,
I have a XML file with a lot of empty tag attributes. For instance:
<mytag id="">
<ontent>aaa</content>
</mytag>
<mytag id="">
<ontent>bbb</content>
</mytag>
<mytag id="">
<ontent>ccc</content>
</mytag>
Now I want to replace id="" with e.g. id="2443" (id="[linenumber]")
I tried to do this with sed, but I did not get a successful result.
I hope someone here can help me :-)