title: sed: replace a block of text
body: <p>I have a bunch of files, starting with a block of code and I'm trying to replace with another.</p>
  
  <p>Replace:</p>
  
  <pre><code>&lt;?php
  $r = session_start();
  (more lines)
  </code></pre>
  
  <p>With:</p>
  
  <pre><code>&lt;?php
  header("Location: index.php");
  (more lines of code)
  </code></pre>
  
  <p>So im trying to match the block with <code>sed 's/&lt;?php\n$r = session_start();/&lt;?php\nheader...</code> but it doesn't work. </p>
  
  <p>I would appreciate help in what is happening here and how to achieve this. I'm thinking in doing this with python instead.</p>
  
  <p>Thanks!</p>