Reputation: 109
i have a xml file and i need to insert a value contains in a variable between PurchaseOrderNumber="99503"
.
For exemple if $value=001
i will have PurchaseOrderNumber="00199503"
.
I tried many commands with sed but nothing work the last one i tried is sed '/^PurchaseOrderNumber=\"/s/^/001/' file.xml > output.xml
can you help me on that
<?xml version="1.0"?>
<PurchaseOrder PurchaseOrderNumber="99503" OrderDate="1999-10-20">
<Address Type="Shipping">
<Name>Ellen Adams</Name>
<Street>123 Maple Street</Street>
<City>Mill Valley</City>
<State>CA</State>
<Zip>10999</Zip>
<Country>USA</Country>
</Address>
<Address Type="Billing">
<Name>Tai Yee</Name>
<Street>8 Oak Avenue</Street>
<City>Old Town</City>
<State>PA</State>
<Zip>95819</Zip>
<Country>USA</Country>
</Address>
</PurchaseOrder>
Upvotes: 0
Views: 67
Reputation: 109
thank's that work, i also found a way so i post it if it's can help anyone
sed 's/PurchaseOrderNumber=\"/&001/' file.xml > output.xml
Upvotes: 0