title: script to parse a text file
body: <p>Any help is greatly appreciated.  I have a Cisco voice gateway that I connect to with SSH and can send a command to get all the current calls on the gateway.  I'm trying to automate this so that I can pull out this information and display it on a big screen TV in an area that needs to see the current active calls at any given moment.</p>
  
  <p>I've got the automated part down already, it will connect to the gateway and pull out the command results in a text file.  Sample output is below.  </p>
  
  <p>I am trying to find a way, perhaps with powershell, or something else, to parse this text file, and just extract two pieces of information: calling# and called# so I can display it in a web page.  The problem is that I need to remove a lot of the headers and stuff and also, the number of callers is not fixed, there can be 0 callers, or 10+ calls at any given time.</p>
  
  <p>Any suggestions on how I may be able to automate this?  </p>
  
  <h2>Sample output:</h2>
  
  <pre>Total SIP call legs:4, User Agent Client:2, User Agent Server:2
  SIP UAC CALL INFO
  No.  CallId    Calling#       Called#        RmtSignalIP                                  RmtMediaIP                                   
       dstCallId SIPState       SIPSubState    
  ========================================================================================================================================
  1    14780     5835           6000           172.30.1.11                                  172.30.1.14                                  
       14779     STATE_ACTIVE   SUBSTATE_NONE  
  2    14784     5820           6000           172.30.1.11                                  172.30.1.14                                  
       14783     STATE_ACTIVE   SUBSTATE_NONE  
     Number of SIP User Agent Client(UAC) calls: 2
  
  SIP UAS CALL INFO
  No.  CallId    Calling#       Called#        RmtSignalIP                                  RmtMediaIP                                   
       dstCallId SIPState       SIPSubState    
  ========================================================================================================================================
  1    14779     5835           5678           172.30.1.12                                  172.30.1.29                                  
       14780     STATE_ACTIVE   SUBSTATE_NONE  
  2    14783     5820           5678           172.30.1.12                                  172.30.1.24                                  
       14784     STATE_ACTIVE   SUBSTATE_NONE  
     Number of SIP User Agent Server(UAS) calls: 2</pre>