title: sed and Mac OS X differences with to upper, to lower and whole capture control sequences
body: <p>I am trying to take the last two letters out of a filename which are uppercase and append them to the filename in lowercase. I expeceted the command:</p>
  
  <pre class="lang-sh prettyprint-override"><code>ls | sed -e "s/.*\([A-Z][A-Z]\)$/\0\/\L\1\E/"
  </code></pre>
  
  <p>to achieve this and on my Ubuntu box it worked fine but on my Mac it simply prints out a <code>0/LXXE/</code> where <code>XX</code> are the correct letters from the capture.</p>
  
  <p>What are the Mac sed equivalents of <code>\0</code>, <code>\L</code> and <code>\E</code>?</p>
  
  <p>I've had a look around the web and several people have noticed that Mac OS X sed is different from Ubuntu sed but most threads talk about the <code>-i</code> requirement for a file extension or empty string (which has previously tripped me up).</p>