title: perl - Extract data using grep and sed
body: <p>I'm using this code to get all titles from urls with <code>http://something.txt</code>:</p>
  
  <pre><code>#!/usr/bin/perl -w
  $output = `cat source.html | grep -o '&lt;a .*href=.*&gt;' | grep -E 'txt' | sed -e 's/&lt;a /\n&lt;a /g' | sed -e 's/&lt;a .*title="//' | cut -f1 -d '"'`;
  
  print("$output");
  </code></pre>
  
  <p>When i run this on perl i get the error:</p>
  
  <pre><code>sed: -e expression #1, char 6: unterminated `s' command
  </code></pre>
  
  <p>The error is related with this portion of code:</p>
  
  <pre><code>sed -e 's/&lt;a /\n&lt;a /g'
  </code></pre>