title: sed not giving me correct substitute operation for newline with Mac - differences between GNU sed and BSD / OSX sed
body: <p>I'm using this reference : <a href="https://stackoverflow.com/questions/19762365/sed-help-matching-and-replacing-a-literal-n-not-the-newline">sed help: matching and replacing a literal &quot;\n&quot; (not the newline)</a></p>
  
  <p>and I have a file "test1.txt" that contains a string hello\ngoodbye</p>
  
  <p>I use this command to search and replace "\n" with actual new line characters:</p>
  
  <pre><code>sed -i '' 's/\\n/\n/g' test1.txt
  </code></pre>
  
  <p>but the result is: <strong>hellongoodbye</strong>.
  it just replaces the "\n" with "n" and not an actual new line. This does the same with /t where it will leave a "t" and not a tab.</p>
  
  <p>the '' is for the undefined error in MAC: <a href="http://mpdaugherty.wordpress.com/2010/05/27/difference-with-sed-in-place-editing-on-mac-os-x-vs-linux/" rel="noreferrer">http://mpdaugherty.wordpress.com/2010/05/27/difference-with-sed-in-place-editing-on-mac-os-x-vs-linux/</a></p>
  
  <p><strong>Update</strong>:</p>
  
  <p>I've tried both of the commands that @hek2mgl suggested:</p>
  
  <pre><code>sed -i 's/\\n/\n/g' test.txt
  # Or:
  sed -i'' 's/\\n/\n/g' test.txt
  </code></pre>
  
  <p>While they might work with Linux, with MAC OS I got the following error:</p>
  
  <pre><code>sed: 1: "test1.txt": undefined label 'est1.txt'
  </code></pre>
  
  <p>Not sure why I can't get this to work. Thanks in advance.</p>