HI Unix Forum,
My requirement
I have two set of Patterns UBA and CIE for which different Phases are there which will have Start and End time. They are not in same order.
I want the o/p in the below mentioned format.
Eg: Mangolia Alien 03:04:56 Phase 0 started (10 seconds)
In the above stmt --- 03:04:36 is Start_Time for Phase0
Hope my Requirement is clear.
Below is an Sample LOg --- That may not make sense as I have changed to protect the data.
Log (This log is not exact but just to indicate the pattern)
<<Any number of lines inbetween>>
[YYYY-MM-DD hh:mm:ss] Standard Output for '/Task: CIE':
--------------------------------------------------------------------------------
Mangolia Alien 03:04:56 Phase 0 started (10 seconds)
<<Any number of lines inbetween>>
--------------------------------------------------------------------------------
[YYYY-MM-DD 03:04:58] Standard Output for '/Task: CIE':
--------------------------------------------------------------------------------
Mangolia Alien 03:04:58 Phase 1 started (0 seconds)
<<Any number of lines inbetween>>
--------------------------------------------------------------------------------
[YYYY-MM-DD 03:05:07] Standard Output for '/Task: CIE':
--------------------------------------------------------------------------------
Mangolia Alien 03:05:07 Phase 2 started (7 seconds)
<<Any number of lines inbetween>>
--------------------------------------------------------------------------------
[YYYY-MM-DD 03:05:12] Standard Output for '/Task: UBA':
--------------------------------------------------------------------------------
Mangolia Alien 03:05:12 Phase 0 started (14 seconds)
<<Any number of lines inbetween>>
--------------------------------------------------------------------------------
[YYYY-MM-DD 03:05:16] Standard Output for '/Task: CIE':
Mangolia Alien 03:05:16 Phase 2 ended (16 seconds)
<<Any number of lines inbetween>>
--------------------------------------------------------------------------------
[YYYY-MM-DD 03:05:19] Standard Output for '/Task: UBA':
Mangolia Alien 03:05:19 Phase 0 ended (21 seconds)
<<Any number of lines inbetween>>
--------------------------------------------------------------------------------
[YYYY-MM-DD 03:05:20] Standard Output for '/Task: UBA':
--------------------------------------------------------------------------------
Mangolia Alien 03:05:20 Phase 1 started (1 second)
<<Any number of lines inbetween>>
[YYYY-MM-DD 03:05:21] Standard Output for '/Task: UBA':
Mangolia Alien 03:05:21 Phase 1 ended (2 seconds)
<<Any number of lines inbetween>>
--------------------------------------------------------------------------------
[YYYY-MM-DD 03:05:23] Standard Output for '/Task: CIE':
--------------------------------------------------------------------------------
Mangolia Alien 03:05:23 Phase 3 started (4 seconds)
<<Any number of lines inbetween>>
--------------------------------------------------------------------------------
[YYYY-MM-DD 03:05:25] Standard Output for '/Task: CIE':
Mangolia Alien 03:05:25 Phase 3 ended (6 seconds)
<<Any number of lines inbetween>>
--------------------------------------------------------------------------------
[YYYY-MM-DD 03:05:27] Standard Output for '/Task: CIE':
--------------------------------------------------------------------------------
Mangolia Alien 03:05:27 Phase 4 started (1 second)
<<Any number of lines inbetween>>
--------------------------------------------------------------------------------
[YYYY-MM-DD 03:05:29] Standard Output for '/Task: UBA':
--------------------------------------------------------------------------------
Mangolia Alien 03:05:29 Phase 2 started (6 seconds)
<<Any number of lines inbetween>>
--------------------------------------------------------------------------------
[YYYY-MM-DD 03:05:31] Standard Output for '/Task: CIE':
Mangolia Alien 03:05:31 Phase 4 ended (4 seconds)
<<Any number of lines in between>>
--------------------------------------------------------------------------------
[YYYY-MM-DD 03:05:32] Standard Output for '/Task: UBA':
Mangolia Alien 03:05:32 Phase 2 ended (8 seconds)
<<Any number of lines inbetween>>
Very urgent... please lets discuss and find a good solution.
Note:
I tried grep -B3 and grep -A3 to first separate UBA and CIE into two separate files and then fetch respective start and end time.
But -B and -A option is not there in AIX
Thanks,
TechGyaann
---------- Post updated at 06:30 PM ---------- Previous update was at 04:55 PM ----------
Can someone look into and assist!!
@Don Cragun or any other Mods please comment.