title: Print lines between two patterns with multiple occurrence of 2nd pattern
body: <p>I have a file like the following and I would like to print the lines between two given patterns PAT1 and PAT2.</p>
  
  <pre><code>1
  2
  PAT1
  3    
  4
  PAT2
  5
  6
  PAT2
  7    
  PAT2
  8
  9
  PAT2
  10    
  </code></pre>
  
  <p>Here PAT1 occurs once, but PAT2 occurs multiple times. I would like to print the lines between PAT1 and the 3rd occurrence of PAT2    </p>
  
  <p>I use the below command to print between patterns which doesn't work in this case</p>
  
  <pre><code>awk '/PAT1/PAT2/'
  </code></pre>
  
  <p>I expect the below output</p>
  
  <pre><code>PAT1
  3    
  4
  PAT2
  5
  6
  PAT2
  7    
  PAT2
  </code></pre>
  
  <p>How can I do that?</p>