How to use sed to replace multiline string?
<p>How can I use the bash <strong>sed</strong> command to change this string:</p>

<pre><code>&lt;Directory /var/www/&gt;
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
&lt;/Directory&gt;
</code></pre>

<p>into the following string? <em>(only changing the 3rd line of string)</em></p>

<pre><code>&lt;Directory /var/www/&gt;
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
&lt;/Directory&gt;
</code></pre>

<p><strong>NOTE 1:</strong> I don't just want to target the string <strong>'AllowOverride None'</strong> because there are other occurrences in the file that should not be changed. I need to target the entire string starting with <code>&lt;Directory /var/www&gt;</code></p>

<p><strong>NOTE 2:</strong> I also need to overwrite the file. So, take that into account in your answer. And provide different versions for GNU/non-GNU versions of sed just in case. </p>