I received an xml file which has been extracted by someone else from a DB. the problem is that it contains some string that are creating problems to read the xml in a correct way. Here it is a small part of it:
<gmd:fileIdentifier xmlns:gmx="http://www.isotc211.org/2005/gmx">\r\n <gco:CharacterString>0211fa18-e0a4-4d2ed26-7580726e593c</gco:CharacterString>\r\n </gmd:fileIdentifier>\r\n <gmd:language>\r\n <gco:CharacterString>eng</gco:CharacterString>\r\n </gmd:language>\r\n <gmd:hierarchyLevel>\r\n <gmd:MD_ScopeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset" />\r\n </gmd:hierarchyLevel>\r\n <gmd:contact>\r\n <gmd:CI_ResponsibleParty>\r\n <gmd:organisationName>\r\n <gco:CharacterString>Research</gco:CharacterString>\r\n </gmd:organisationName>\r\n <gmd:contactInfo>\r\n <gmd:CI_Contact>\r\n <gmd:address>\r\n <gmd:CI_Address>\r\n <gmd:electronicMailAddress>\r\n <gco:CharacterString>[email protected]</gco:CharacterString>\r\n </gmd:electronicMailAddress>\r\n </gmd:CI_Address>\r\n </gmd:address>\r\n </gmd:CI_Contact>\r\n </gmd:contactInfo>\r\n
As you can see at the end of each tag there is the string "\r\n" which is the problem. I tried using the following bash command:
string='\r\n'
sed -i 's/$string/''/g' test.xml
but it is not working, no empty string is substituting the $string variable.
could you please tell me what I'm doing wrong?
thanks in advance