title: Test for pattern A and B and return text lines in-between and including pattern A & B
body: <p>Hello again stackoverflow!</p>
  
  <p>I have a very large flat file which I am looking to export all records that match 2 different patterns.  The issue is the number of lines in each record is different and the records bleed into each other.  The last line of a record is Door ID, the first line is User: .  </p>
  
  <p>I am testing against @ in the email address and the last login contains 'login time: 2013-08'. I need to export all lines including the email address line and last login line. below are to 2 samples.  I have tried using awk like so:</p>
  
  <pre><code>awk '/login time: 2013-08/{e=0}/@ /{gsub("^.*@ ","",$0);e=1}{if(e==1){print}}'  filename
  </code></pre>
  
  <p>and of course that failed....</p>
  
  <p>so here is the sample data</p>
  
  <pre><code>User: afshin@runners.org
  First Name: Afshi
  Last Name: Noghami
  Is Delegated Admin: False
  IP Whitelisted: False
  Account Suspended: False
  Must Change Password: False
  Unique ID: 102209840259208897543
  ID TPYE: Cx4
  Creation Time: 2013-06-07T04:14:42.000Z
  Last login time: Never
  Path: /Members/Inactive
  
  IMs:
  Addresses:
  Organizations:
  Phones:
  Relations:
  Door IDs:
  User: jjnalli@runners.org
  First Name: JISS
  Last Name: NALLIKUZHY
  Is a Super Admin: False
  Is Delegated Admin: False
  Has Agreed to Terms: True
  IP Whitelisted: False
  Account Suspended: False
  Must Change Password: False
  Unique ID: 109765147242431344122
  ID TYPE: Cx4
  Mailbox setup: True
  Included: False
  Creation Time: 2013-06-07T03:32:52.000Z
  Last login time: 2013-08-02T07:13:02.000Z
  Path: /Members/Inactive
  
  IMs:
  Addresses:
  Organizations:
  Phones:
  Relations:
  Door IDs:
  </code></pre>
  
  <p>The desired output would look like below for each record that has a last login date:</p>
  
  <pre><code>User: jjnalli@runners.org  
  First Name: JISS  
  Last Name: NALLIKUZHY  
  Is a Super Admin: False  
  Is Delegated Admin: False  
  Has Agreed to Terms: True  
  IP Whitelisted: False  
  Account Suspended: False  
  Must Change Password: False  
  Unique ID: 109765147242431344122  
  ID TYPE: Cx4  
  Mailbox setup: True  
  Included: False  
  Creation Time: 2013-06-07T03:32:52.000Z  
  Last login time: 2013-08-02T07:13:02.000Z 
  </code></pre>