I have an xml file which I am editing manually. The xml file structure is as follows:
<order>
<id>1</field>
<current_execution_status>REGENERATED</field>
<generated_time>2012-12-01 17:55:00</field>
<generation_status>UNKNOWN</field>
<priority>0</field>
<type>NORMAL</field>
<assigned_vehicle>1</field>
<assigned_drop_location>1</field>
<assigned_pick_location>1</field>
<generation_by_user_name>ABC</field>
<material>1</field>
<order_cancel_detail />
<order_drop_detail />
<order_pick_detail />
</order>
I wanted to replace each occurrence of field with respective “field names” from in front of the values. For e.g. <id>1</field> should become <id>1</id>, <current_execution_status>REGENERATED</current_execution_status>, etc. like this way. But not getting what should be my regex for this in vim.
1 Answer