[SOLVED]Parts of string from text file.
Posted: Tue Apr 05, 2011 5:00 am
Hi!
I have a problem with an assignment, it's a tough one for me as I'm a beginner.
Any help will be greatly appreciated.
The file is a phone server log.
It consists of calls, and each call consists of several parts, which are:
A call= person A dials
B call= reaches person B's network
B proceed= person B's network accepts the call
B alert= person B's phone starts to ring
B connect= person B accepts the call
B rel= person B hangs up
A rel= person A hangs up
All the parts are separate inputs(strings), the two I'm interested in are the Proceed part and the Release(Rel) part.
Each string is on separate row.
An example of these from a call:
[text]?event=B:Proceed&time=1301660602&date=20110401-122322&ref=6612d8afe909d311ac9d0090331594f7&dir=out&src_if=GW1&dst_if=GW2&src_cgpn=3054&src_cdpn=53484699&dst_cgpn=53097707&dst_dgpn=53097707&dst_cdpn=53484699&src_reg_name=outsideline&bcaps=03_80_90_a3&xcoder=-,0(0,0,0)&rcoder=-,0(0,0,0)&xstats=0+0+0+0+0&rstats=0+0+0+0+0&srv_id=00-90-33-08-04-a4
?event=A:Rel&time=1301660617&date=20110401-122337&ref=6612d8afe909d311ac9d0090331594f7&dir=in&src_if=GW1&dst_if=GW2&src_cgpn=3054&src_cdpn=53484699&dst_cgpn=53097707&dst_dgpn=53097707&dst_cdpn=53484699&src_reg_name=outsideline&bcaps=03_80_90_a3&xcoder=G711A,30(0,0,0)&rcoder=G711A,30(1,0,0)&xstats=0+0+0+0+0&rstats=1+1+0+0+0&alert_time=1301660605&connect_time=1301660609&disc_time=1301660617&srv_id=00-90-33-08-04-a4
[/text]
Now, the important parts from each call are these two strings.
Every call is uniquely identified by the randomly generated string - "ref=******" [ref=6612d8afe909d311ac9d0090331594f7 in this example]
Different parameters in each part of the call are separated by the & char.
I'm only interested in the outgoing calls, which all go through the 53097707 number, which is shown in the dst_cgpn=53097707.
There are other calls that go through other numbers, but I'm only interested in the ones where dst_cgpn=53097707.
The callers number is also very important - src_cgpn. in this example src_cgpn=3054.
The third important part is the time, time= - in this example time=1301660602.
Fourth part is the date and time of the call, which is in the date part - in this example date=20110401-122337, where the date is 20110401(2011-04-01 / y-m-d)
and the time is 122337 (12:23:37).
One mayor problem for me is that the calls are overlapping, e.g some calls may be ongoing while some end or start etc.
The reason why it's necessary to look at two parts from each call (Proceed and Release) is that I need to get the duration of the call.
Which means that the difference between the time in the Proceed and the Release parts has to be taken.
The ideal result would be a table, which has:
1. column - the number, from which the call was made (src_cgpn=****).
2. column - duration of the call in seconds.
3. column - the date and time of the call.
I hope I explained the situation with enough clarity and that someone will have the time to help me.
Of course I can answer any additional questions.
Any help will be greatly appreciated.
Thanks in advance,
Miniamba.
I have a problem with an assignment, it's a tough one for me as I'm a beginner.
Any help will be greatly appreciated.
The file is a phone server log.
It consists of calls, and each call consists of several parts, which are:
A call= person A dials
B call= reaches person B's network
B proceed= person B's network accepts the call
B alert= person B's phone starts to ring
B connect= person B accepts the call
B rel= person B hangs up
A rel= person A hangs up
All the parts are separate inputs(strings), the two I'm interested in are the Proceed part and the Release(Rel) part.
Each string is on separate row.
An example of these from a call:
[text]?event=B:Proceed&time=1301660602&date=20110401-122322&ref=6612d8afe909d311ac9d0090331594f7&dir=out&src_if=GW1&dst_if=GW2&src_cgpn=3054&src_cdpn=53484699&dst_cgpn=53097707&dst_dgpn=53097707&dst_cdpn=53484699&src_reg_name=outsideline&bcaps=03_80_90_a3&xcoder=-,0(0,0,0)&rcoder=-,0(0,0,0)&xstats=0+0+0+0+0&rstats=0+0+0+0+0&srv_id=00-90-33-08-04-a4
?event=A:Rel&time=1301660617&date=20110401-122337&ref=6612d8afe909d311ac9d0090331594f7&dir=in&src_if=GW1&dst_if=GW2&src_cgpn=3054&src_cdpn=53484699&dst_cgpn=53097707&dst_dgpn=53097707&dst_cdpn=53484699&src_reg_name=outsideline&bcaps=03_80_90_a3&xcoder=G711A,30(0,0,0)&rcoder=G711A,30(1,0,0)&xstats=0+0+0+0+0&rstats=1+1+0+0+0&alert_time=1301660605&connect_time=1301660609&disc_time=1301660617&srv_id=00-90-33-08-04-a4
[/text]
Now, the important parts from each call are these two strings.
Every call is uniquely identified by the randomly generated string - "ref=******" [ref=6612d8afe909d311ac9d0090331594f7 in this example]
Different parameters in each part of the call are separated by the & char.
I'm only interested in the outgoing calls, which all go through the 53097707 number, which is shown in the dst_cgpn=53097707.
There are other calls that go through other numbers, but I'm only interested in the ones where dst_cgpn=53097707.
The callers number is also very important - src_cgpn. in this example src_cgpn=3054.
The third important part is the time, time= - in this example time=1301660602.
Fourth part is the date and time of the call, which is in the date part - in this example date=20110401-122337, where the date is 20110401(2011-04-01 / y-m-d)
and the time is 122337 (12:23:37).
One mayor problem for me is that the calls are overlapping, e.g some calls may be ongoing while some end or start etc.
The reason why it's necessary to look at two parts from each call (Proceed and Release) is that I need to get the duration of the call.
Which means that the difference between the time in the Proceed and the Release parts has to be taken.
The ideal result would be a table, which has:
1. column - the number, from which the call was made (src_cgpn=****).
2. column - duration of the call in seconds.
3. column - the date and time of the call.
I hope I explained the situation with enough clarity and that someone will have the time to help me.
Of course I can answer any additional questions.
Any help will be greatly appreciated.
Thanks in advance,
Miniamba.