Friday, 25 March 2016

XML : how can i trim string between xml tag with sed?

I need to remove blank spaces between two pattern. Input file is xml. I need to keep xml format. I've this input:

  <?xml version="1.0" encoding="UTF-8"?>  <dvm name="Filename" xml="http://www.google.it">    <description>AL</description>    <columns>      <column>abc d e</column>      <column> fg </column>    </columns>    <rows>      <row>        <cell id="1">08 4 </cell>        <cell id="2">AG</cell>      </row>      <row>        <cell id="1">006</cell>        <cell id="2"> AL</cell>      </row>      <row>        <cell id="1">042 </cell>        <cell id="2">AN  </cell>      </row>     </rows>    

I'd like to have below output using sed command:

  <?xml version="1.0" encoding="UTF-8"?>  <dvm name="Filename" xml="http://http://www.google.it">    <description>AL</description>    <columns>      <column>abcde</column>      <column>fg</column>    </columns>    <rows>      <row>        <cell id="1">084</cell>        <cell id="2">AG</cell>      </row>      <row>        <cell id="1">006</cell>        <cell id="2">AL</cell>      </row>      <row>        <cell id="1">042</cell>        <cell id="2">AN</cell>      </row>     </rows>    

Can someone help me?

No comments:

Post a Comment