I have a large set of logs as shown below:June   5 15:51:56.606  [3997]:   TR#153. State machine - state = CC_STATE_IDLE, event = EVT_ISDN_SETUPJune   5 15:51:56.607  [3997]:   TR#153):  SC registration SUCCESS.June   5 15:52:00.368  [3997]:   TR#153. DSP:4 Channel:26 Type: Modem State: Data June   5 15:52:01.837  [3997]:   TR#153. Receive transaction data: prot 1 data length: 159.-------------------->>June   5 15:52:02.073  [3997]:   TR#153. Send transaction data: 55 <<-------------------June   5 15:52:04.361  [3997]:   TR#153):Disconnect initated by 32 process.June   5 15:52:57.382  [3997]:   TR#153. State machine - state = CC_STATE_IDLE, event = EVT_ISDN_SETUPJune   5 15:52:57.383  [3997]:   TR#153):  SC registration SUCCESS.June   5 15:53:01.327  [3997]:   TR#153. DSP:4 Channel:26 Type: Modem State: Data June   5 15:53:04.291  [3997]:   TR#153. Receive transaction data: prot 1 data length: 347.-------------------->>June   5 15:53:05.071  [3997]:   TR#153. Send transaction data: 103 <<-------------------June   5 15:53:06.209  [3997]:   TR#153. Receive transaction data: prot 1 data length: 24.-------------------->>June   5 15:53:07.239  [3997]:   TR#153):Disconnect initated by 32 process.I would like to find the time difference b/w the events 'EVT_ISDN_SETUP' and 'Disconnect', essentially each transactions duration. For this I need to extract the time stamp from corresponding lines first and find the difference. I tried the Perl code here to find the difference for one instance and it worked fine. My task would be then to successfully get the time stamps b/w the interested events and then feed to Perl code and print the difference along with TR#ID. How do I go about it?
Extract time stamps and find the difference
text processing;perl;timestamps
Assumption: For every line containing EVT_ISDN_SETUP there is line containing Disconnectpattern.Let me paste you the algorithm:  Get the time field for the line matching `EVT_ISDN_SETUP` pattern and put it to temp1 file  Get the time field for the line matching `Disconnect`pattern and put it to another file say temp2.  Using paste command put the content of both the files to another file say temp3.  Read every line of the temp3 and pass first & 2nd field your perl script .