title: Using Sed with Regular Expressions for Sub-string replacement
body: <p>I'm using Ubuntu Natty.</p>
  
  <p>I'm trying to use sed to do a string replacement using the command line.</p>
  
  <p>The part of the text file (app.config) I'm trying to replace is as below:</p>
  
  <pre><code>%% http is a list of IP addresses and TCP ports that the Riak
  %% HTTP interface will bind.
  {http, [ {"127.0.0.1", 8098 } ]},
  </code></pre>
  
  <p>And I'm trying to replace the IP address with something else. Here's my code:</p>
  
  <pre><code> ip="192.168.10.12"    
   sed -i "s/\(\{http,[\t ]*\[[\t ]*\{\)\"[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\"/\1\"$ip\"/" /root/sandbox/app.config
  </code></pre>
  
  <p>However, I get an error <code>sed: -e expression #1, char 103: Invalid preceding regular expression</code>.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks in advance.</p>