title: Perl regular expression help (parse out column)
body: <p>Im stuck here. Not sure why my reg ex won't work. I have a pipe delimited text file with a series of columns. I need to extract the 3rd column.</p>
  
  <h2>File:</h2>
  
  <pre><code>A|B|C|D|E|F|G|H|I
  2011-03-03 00:00:00.0|1|60510271|254735|27751|BBB|1|-0.1619023623|-0.009865904
  2011-03-03 00:00:00.0|1|60510270|254735|27751|B|3|-0.0064786612|-0.0063739185
  2011-03-03 00:00:00.0|1|60510269|254735|27751|B|3|-0.0084998226|-0.009244384
  </code></pre>
  
  <h2>Regular expression:</h2>
  
  <pre><code>$&gt; head foo | perl -pi -e 's/^(.*)\|(.*)\|(.*)\|(.*)$/$3/g'
  </code></pre>
  
  <h2>Output</h2>
  
  <pre><code>-0.1619023623
  -0.0064786612
  -0.0084998226
  </code></pre>
  
  <p>Clearly not the correct column being outputted.</p>
  
  <p>Thoughts ?</p>