powershell - script to parse a text file -


any appreciated. have cisco voice gateway connect ssh , can send command current calls on gateway. i'm trying automate can pull out information , display on big screen tv in area needs see current active calls @ given moment.

i've got automated part down already, connect gateway , pull out command results in text file. sample output below.

i trying find way, perhaps powershell, or else, parse text file, , extract 2 pieces of information: calling# , called# can display in web page. problem need remove lot of headers , stuff , also, number of callers not fixed, there can 0 callers, or 10+ calls @ given time.

any suggestions on how may able automate this?

sample output:

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

you can use get-content , interate through it, starting "======" , ended "number of sip user agents .." between lines data, need more parsing (trim spaces etc)


Comments