Hi,
I am trying to substitute an attributes value using sed command but it is only possible to substitute the value without space.
input xml
<BillingAddress11300000 Tag="11300000" SectionID="BLA" CustAddrName="CLAUDIA LUCIA DE ALMEIDA" CustAddrStreet="AV ENGENHEIRO RICHARD" CustAddrState="RJ" CustAddrZip="20561-090" CustAddrStreetNo="64" CustAddrComplement="APTO 303" CustAddrCity="RIO DE JANEIRO" CustAddrCounty="GRAJAU"/>
it will read the attribute and value will store it in variable
required output
<BillingAddress11300000 Tag="11300000" SectionID="BLA" CustAddrName="Rodrigo DE Silva" CustAddrStreet="AV ENGENHEIRO RICHARD" CustAddrState="RJ" CustAddrZip="20561-090" CustAddrStreetNo="64" CustAddrComplement="APTO 303" CustAddrCity="RIO DE JANEIRO" CustAddrCounty="GRAJAU"/>
I used the following script
#!/bin/bash
echo "Enter the attribute name"
read att
echo "enter new value"
read value
sed "s|$att\=\S*\S|$att=\"$value\"|g" test.xml>>out.xml
It is possible to substitute the attribute's value with this code with no space but it is not possible the f value substitution (The one with the space) with this script
How to implement this scenario?