I am trying to convert
<id>1</id>
<Name>ENTERPRISE RESOURCE PLANNING</Name>
to:
<column name="id">1</column>
<column name="Name">ENTERPRISE RESOURCE PLANNING</column>
I am assuming the best tool for the job would be sed, however I can't figure out how to keep parts of the original text in the replace part.
If I do:
$ sed -i 's/<.*>.*<.*>/<column name="\\1">\\2<\/column>/g' filename.xml
The output is:
<column name="\1">\2</column>
<column name="\1">\2</column>
Or doing similar from within vi, it outputs:
<column name=""></column>
<column name=""></column>
How can I make it so that \1 and \2 are substituted back to their original values?