title: Applying multiple regexes in awk
body: <p>I have a big log file. I have to apply multiple regexes one by one and before printing the output of each regex i need to print some text.</p>
  
  <p>For eg. </p>
  
  <p>After applying the regexes, I should get output something like this:</p>
  
  <pre><code>Text 1
  
  Output of first regex
  ....
  
  
  Text 2 
  
  Output of second regex
  ....
  
  Text 3
  
  Output of third regex
  ....
  </code></pre>
  
  <p>where Text 1, Text 2 and Text 3 are my inserted texts. Can we achieve this using AWK.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I am adding part of the sample log file.</p>
  
  <pre><code>[1351059075] SERVICE ALERT: server1:Email;CRITICAL;HARD;3;Connection refused
  [1351059898] SERVICE ALERT: server1:Email;CRITICAL;HARD;3;Connection refused
  [1351073883] SERVICE ALERT: server2:History ;CRITICAL;HARD;3;HTTP CRITICAL 
  [1351073886] SERVICE ALERT: server2:History ;CRITICAL;HARD;3;HTTP CRITICAL
  [1351088949] SERVICE ALERT: server3:PSU ;CRITICAL;HARD;3;Connection refused
  </code></pre>
  
  <p>Now I want to separate all <code>Email</code> , <code>History</code>, <code>PSU</code> so my output should look like this:</p>
  
  <pre><code>Email:
  
  [1351059075] SERVICE ALERT: server1:Email;CRITICAL;HARD;3;Connection refused
  [1351059898] SERVICE ALERT: server1:Email;CRITICAL;HARD;3;Connection refused
  
  History:
  
  [1351073883] SERVICE ALERT: server2:History ;CRITICAL;HARD;3;HTTP CRITICAL 
  [1351073886] SERVICE ALERT: server2:History ;CRITICAL;HARD;3;HTTP CRITICAL
  
  PSU:
  
  [1351088949] SERVICE ALERT: server3:PSU ;CRITICAL;HARD;3;Connection refused 
  </code></pre>
  
  <p>I wrote a simple awk script:</p>
  
  <pre><code>awk 'BEGIN {print "Email:\n\n"} /SERVICE ALERT: .*Email.*CRITICAL;HARD/ {print $0}' logfilename
  </code></pre>
  
  <p>I dont know how to include multiple regexes in the same awk script so as to print in the desired way.</p>