title: Insert linefeed in sed (Mac OS X)
body: <p>How do I insert a newline in the replacement part of sed?</p>
  
  <p>This code isn't working:</p>
  
  <pre><code>sed "s/\(1234\)/\n\1/g" input.txt &gt; output.txt
  </code></pre>
  
  <p>where input.txt is:</p>
  
  <pre><code>test1234foo123bar1234
  </code></pre>
  
  <p>and output.txt should be:</p>
  
  <pre><code>test
  1234foo123bar
  1234
  </code></pre>
  
  <p>but insted I get this:</p>
  
  <pre><code>testn1234foo123barn1234
  </code></pre>
  
  <p><strong>NOTE:</strong></p>
  
  <p>This question is specifically about the Mac OS X version of "sed", and the community has noted that it behaves differently than, say, Linux versions.</p>