title: how to replace one group of strings in one file with another group from another file
body: <p>I have two files with content like below</p>
  
  <p><code>file1</code></p>
  
  <pre><code>   pattern1something1end1
     pattern1something2end2
     pattern2something3end3
     pattern2something4end4
     pattern3something5end5
     pattern4something6end6
  </code></pre>
  
  <p><code>file2</code></p>
  
  <pre><code>   pattern0something7end7
     pattern1something8end8
     pattern1something9end9
     pattern2something10end10
     pattern2something11end11
     pattern2something12end12
     pattern3something13end13
     pattern4something14end14
  </code></pre>
  
  <p>Now I want <code>file1</code> to be changed with all lines starting from <code>pattern2</code> be replaced by all lines in <code>file2</code> which start with same <code>pattern2</code> in <code>linux</code> environment</p>
  
  <p>so the final content in <code>file1</code> will be like below</p>
  
  <pre><code>   pattern1something1end1
     pattern1something2end2
     pattern2something10end10
     pattern2something11end11
     pattern2something12end12
     pattern3something5end5
     pattern4something6end6
  </code></pre>
  
  <p>Number of lines can be different for any pattern in both files and replacement shall be done with group of lines.</p>
  
  <p>There will be only one group of lines starting with any pattern in both the files.</p>
  
  <p>I would like to preferably use sed, but its not a constraint.</p>
  
  <p>Similarly solution shall also work , if want to do similar exercise for <code>pattern1</code> or <code>pattern3</code></p>