title: shell script: inserting a new line to a file using sed
body: <p>Currently, the file a.txt has:</p>
  
  <pre><code>#define ABC
  </code></pre>
  
  <p>I want to change a.txt to:</p>
  
  <pre><code>#define ABC
  #define DEF
  </code></pre>
  
  <p>And I tried </p>
  
  <pre><code>sed 's/#define ABC/#define ABC&amp;\n#define DEF/g' a.txt &gt; tmp/test.txt
  mv tmp/test.txt &gt; a.txt
  </code></pre>
  
  <p>but it's giving me <code>#define ABC#define ABCn#define EDF</code> instead. Tried multiple solutions online but it's not working. What is wrong with my solution? Thanks!!!</p>
  
  <p>Working on Solaris 11</p>