Search and replace unix command line, perl capture group empty
<p>I'm trying to perform a recursive search and replace of file content in multiple files.</p>

<p>Given the below in a number of files:</p>

<pre><code>example:{
  something: 'ha',
  somethingElse: 'ah'
}
</code></pre>

<p>I'd like to end up with:</p>

<pre><code>example:{
  something: 'ha',
  somethingElse: 'ah',
  somethingNew: 'ah ha'
}
</code></pre>

<p>On Mac OS X, I am trying the following from command line from within a parent directory:</p>

<pre><code>find . -type f -exec perl -p -i -e "s/somethingElse:(.*)/somethingElse:$1,\n\tsomethingNew: 'ah ha'/g" {} \;
</code></pre>

<p>It's almost working except the capture group is interpreted as blank resulting in:</p>

<pre><code>example:{
  something: 'ha',
  somethingElse:,
  somethingNew: 'ah ha'
}
</code></pre>

<p>What's the problem?</p>

<p>Also not tied to <code>perl</code>, I don't mind an alternative approach (can use <code>sed</code> for example)</p>