title: extract the last repetitive section of a txt file
body: <p>I have a very big .txt file which contains multiple repetitive sections with the same format but different values. I would like to extract the last repetition and store it into a .csv file. </p>
  
  <p>I have successfully extracted all three repetition and do not know how to proceed. Potentially a script could help but I do not have the logic behind it since I am still a beginner in shell scripting.</p>
  
  <p>The expected result would only contain the last repetition of the series.
  The extraction codes:</p>
  
  <pre><code>sed -ne '/Summary of Natural Population Analysis:/,/* Total * /p'
  </code></pre>
  
  <p>What I have now: </p>
  
  <p><b>Summary of Natural Population Analysis:                  </p>
  
  <pre><code>                                   Natural Population 
              Natural  -----------------------------------------------
  Atom  No    Charge         Core      Valence    Rydberg      Total
  </code></pre>
  
  <hr>
  
  <pre><code>  P    1   -0.00730      9.99875     4.96888    0.03967    15.00730
    H    2    0.00243      0.00000     0.99263    0.00493     0.99757
    H    3    0.00243      0.00000     0.99263    0.00493     0.99757
    H    4    0.00243      0.00000     0.99263    0.00493     0.99757
  </code></pre>
  
  <p>=======================================================================
     * Total *    0.00000      9.99875     7.94678    0.05447    18.00000</p>
  
  <p>Summary of Natural Population Analysis:                  </p>
  
  <pre><code>                                   Natural Population 
              Natural  -----------------------------------------------
  Atom  No    Charge         Core      Valence    Rydberg      Total
  </code></pre>
  
  <hr>
  
  <pre><code>  P    1    0.03819      9.99894     4.93544    0.02743    14.96181
    H    2   -0.01273      0.00000     1.00784    0.00489     1.01273
    H    3   -0.01273      0.00000     1.00784    0.00489     1.01273
    H    4   -0.01273      0.00000     1.00784    0.00489     1.01273
  </code></pre>
  
  <p>=======================================================================
     * Total *    0.00000      9.99894     7.95896    0.04210    18.00000</p>
  
  <p>Summary of Natural Population Analysis:                  </p>
  
  <pre><code>                                   Natural Population 
              Natural  -----------------------------------------------
  Atom  No    Charge         Core      Valence    Rydberg      Total
  </code></pre>
  
  <hr>
  
  <pre><code>  P    1    0.03819      9.99894     4.93544    0.02743    14.96181
    H    2   -0.01273      0.00000     1.00784    0.00489     1.01273
    H    3   -0.01273      0.00000     1.00784    0.00489     1.01273
    H    4   -0.01273      0.00000     1.00784    0.00489     1.01273
  </code></pre>
  
  <p>=======================================================================
     * Total *    0.00000      9.99894     7.95896    0.04210    18.00000
  </b></p>
  
  <p>What I would like to have: 
  just </p>
  
  <p><b>Summary of Natural Population Analysis:                  </p>
  
  <pre><code>                                   Natural Population 
              Natural  -----------------------------------------------
  Atom  No    Charge         Core      Valence    Rydberg      Total
  </code></pre>
  
  <hr>
  
  <pre><code>  P    1    0.03819      9.99894     4.93544    0.02743    14.96181
    H    2   -0.01273      0.00000     1.00784    0.00489     1.01273
    H    3   -0.01273      0.00000     1.00784    0.00489     1.01273
    H    4   -0.01273      0.00000     1.00784    0.00489     1.01273
  </code></pre>
  
  <p>=======================================================================
     * Total *    0.00000      9.99894     7.95896    0.04210    18.00000
  </b></p>