title: how to modify an xml file and add an inner node?
body: <p>I have this xml file:</p>
  
  <pre><code>&lt;xml&gt;
  &lt;segmentrecorddb&gt;
  
  ...
  
  &lt;/segmentrecorddb&gt;
  &lt;/xml&gt;
  </code></pre>
  
  <p>I want to write a sh file that will add an inner xml node</p>
  
  <p>meaning the file will be:</p>
  
  <pre><code>   &lt;xml&gt;
      &lt;segmentrecorddb&gt;
      &lt;myNoed&gt;
      &lt;/myNoed&gt;
      ...
  
      &lt;/segmentrecorddb&gt;
     &lt;/xml&gt;
  </code></pre>
  
  <p>how can I delete the first two lines</p>
  
  <p>add the 2 lines and add </p>
  
  <p>
      
      
      </p>
  
  <p><strong>Edit1:</strong></p>
  
  <p>I have tried:
  <code>➜  Downloads  sed "s/&lt;xml&gt;&lt;segmentrecorddb&gt;/&lt;xml&gt;&lt;segmentrecorddb&gt;&lt;myNode&gt;&lt;/myNode&gt;/" menyHtml.html &gt; menyHtml.html</code></p>
  
  <p>and got:</p>
  
  <p><code>sed: 1: "s/&lt;xml&gt;&lt;segmentrecorddb ...": bad flag in substitute command: 'm'</code></p>
  
  <p>Edit2:</p>
  
  <pre><code>&lt;xml&gt;
  &lt;segmentrecorddb&gt;
  
  ...
  
  &lt;/segmentrecorddb&gt;
  &lt;/xml&gt;
  </code></pre>
  
  <p>I ran </p>
  
  <pre><code>sed 's/&lt;segmentrecorddb&gt;/&lt;segmentrecorddb&gt;\n&lt;myNode&gt;&lt;\/myNode&gt;/' &lt; menyHtml.html &gt; menyHtml1.html
  </code></pre>
  
  <p>for the input</p>
  
  <p>and got output:</p>
  
  <pre><code>  &lt;xml&gt;
      &lt;segmentrecorddb&gt;n&lt;myNode&gt;&lt;/myNode&gt;
  
          ...
  
      &lt;/segmentrecorddb&gt;
  &lt;/xml&gt;
  </code></pre>
  
  <p>how can I fix this?</p>