title: Replace a multiline string with pattern using sed command
body: <p>I would like to replace a string where the content is multiline. At each end of line, it can be a /n or \r\n, for the indentation, it can be tabulation or spaces, I don't know. I think the best way to find the string is to use pattern and replace it using sed. This is the content of the file :</p>
  
  <pre><code>&lt;Element Blabla&gt;        
          A content
          A second content
          A third content
  &lt;/Element&gt;
  &lt;Element TheSearchedElement&gt;        
          A content
          A second content
          A third content
  &lt;/Element&gt;
  &lt;Element Blabla2&gt;        
          A content
          A second content
          A third content
  &lt;/Element&gt;
  </code></pre>
  
  <p>I want to replace this block :</p>
  
  <pre><code>&lt;Element TheSearchedElement&gt;        
          A content
          A second content
          A third content
  &lt;/Element&gt;
  </code></pre>
  
  <p>By this block :</p>
  
  <pre><code>&lt;Element TheSearchedElement&gt;        
          A content
          A second replaced
          A third content
  &lt;/Element&gt;
  </code></pre>
  
  <p>I think I should create a variable oldPattern which contains the pattern to find and a variable newPattern which contains the new pattern to write.
  This is the content of my script :</p>
  
  <pre><code>$oldPattern='&lt;Element TheSearchedElement&gt;*A content*A second content*A third*content*&lt;/Element&gt;'
  $newPattern='&lt;Element TheSearchedElement&gt;/n/tA content/n/tA second replaced/n/tA third*content/n&lt;/Element&gt;'
  sed -e '/oldPattern/newPattern/' file.conf
  </code></pre>
  
  <p>The problem is I have an error at output :
  script.sh: 1: script.sh: =<em>A content</em>A second content<em>A third</em>content*: not found
  script.sh: 2: script.sh: =/n/tA content/n/tA second replaced/n/tA third*content/n: not found
  sed: -e expression n°1, char 14: useless chars after command</p>
  
  <p>I hope you will can help me.</p>