I would like to remove the string    currencyId=GBP   from an xml file. Please note there is a single space before the first letter c. I am having trouble parsing the data and removing this string (including the initial space) would make it easier for me. I know I can use sed, but the space at the start of the string and double quotes seems to be tripping me up in my attempts so far. To clarify here is an sample of the xml. <location>Ethiopia</location><country>ET</country><shippingInfo>   <shippingServiceCost currencyId=GBP>2.83</shippingServiceCost><shippingType>Flat</shippingType><shipToLocations>Worldwide</shipToLocations></shippingInfo><sellingStatus><currentPrice currencyId=USD>157.5</currentPrice><convertedCurrentPrice currencyId=GBP>111.45</convertedCurrentPrice>If I achieve my objective, the convertedCurrentPrice line would read:<convertedCurrentPrice>111.45</convertedCurrentPrice>
Remove string with spaces and quotes from xml file
shell script;text processing;sed;xml
sed -i 's/ currencyId=GBP//' file.xml - This works for me. Add a g at the end of the sed command if you want to replace all instances.