title: Edit XML file using the same commands on mac, windows and linux
body: <p>Trying to change name="Android" to name="Android1", name="Android2" and so on..</p>
  
  <p>Will need to run my python script using the command line on windows, macOS and Linux.</p>
  
  <p><strong>Output2.xml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; 
      &lt;robot generator="Robot 2.9 (Python 3.6.8 on linux)" generated="20190701 08:47:35.439"&gt; 
      &lt;suite id="s1" name="Android" source="/FILEPATHHERE"&gt;
      #ommitted unrelevant lines from xml file
  </code></pre>
  
  <p><strong>Problem</strong></p>
  
  <p>I have tried a couple of ways listed on Stackoverflow but realized that it is not as easy as it seems.</p>
  
  <p>Was just trying the ways using my mac terminal and when I tried running this:</p>
  
  <pre class="lang-sh prettyprint-override"><code>sed -i 's/android/newtext' output2.xml 
  </code></pre>
  
  <blockquote>
    <p>Error: sed: 1: "output2.xml": invalid command code o</p>
  </blockquote>
  
  <p>Added in <code>''</code> but another new error came up:</p>
  
  <pre class="lang-sh prettyprint-override"><code>sed -i '' 's/android/newtext' output2.xml
  </code></pre>
  
  <blockquote>
    <p>Error: sed: 1: "s/android/newtext": unterminated substitute in regular expression</p>
  </blockquote>
  
  <p>Can I use sed commands? Seems like I am doing it wrong as I have some issues in editing XML using sed commands.</p>
  
  <p><strong>Main References</strong></p>
  
  <p><a href="https://askubuntu.com/questions/20414/find-and-replace-text-within-a-file-using-commands">https://askubuntu.com/questions/20414/find-and-replace-text-within-a-file-using-commands</a>
  <a href="https://superuser.com/questions/916665/edit-xml-file-using-shell-script-command">https://superuser.com/questions/916665/edit-xml-file-using-shell-script-command</a></p>