Am in need of your help to get the desired output.
nameSECURITY.SERVICES.CONFIG:GETVALUEisPrefetchedNsAccessLast2013-09-13 10:50:13 MESTsAccessTotal1sRunningcHitLastnamePUBLIC.SERVER:INVOKEisPrefetchedNsAccessLast2013-09-17 15:02:05 MESTsAccessTotal713991sRunning1namePUBLIC.STRING:CONVERTTOSTRINGisPrefetchedNsAccessLast2013-09-17 03:01:54 MESTsAccessTotal961sRunningcHitLast
1) I have data which has more thand 10,000 lines with the above same pattern.
2) I was checking the value of parameter 'sRunning' which should be a numerical value ( i.e, greater than 0 )
3) Here in the above live data the parameter(sRunning) is 'cHitLast and in the second case it is 1
4) I need to print the above 4 + 1(including sRunning ) values whereever the sRunning has a value greater than 0 ( zero) example shown below
5) Need to ignore if the value of sRunning which is other than numerical.
For the above code the output should be as below
name isPrefetched sAccessLast sAccessTotal sRunningPUBLIC.SERVER:INVOKE N 2013-09-17 15:02:05 MEST 713991 1
This was code given by jotne and it worked for some part but latter am not able to get the desired output.
nawk ' !f{ff=$0; f=1} !x && NR%2 { if(!(f>1 && $0 ~ ff)){printf "%s\t" "\t", $0} if(f==1){f++;next}} !(NR%2) { d=d" "$0 } $0 ~ ff {print "\n"d; x=1;d=""} END{print d} '
Thanks a lot for your support.
---------- Post updated at 01:37 PM ---------- Previous update was at 01:34 PM ----------
Correction in the previous data
-----------------------------
name
SECURITY.SERVICES.CONFIG:GETVALUE
isPrefetched
N
sAccessLast
2013-09-13 10:50:13 MEST
sAccessTotal
1
sRunning
cHitLast
name
PUBLIC.SERVER:INVOKE
isPrefetched
N
sAccessLast
2013-09-17 15:02:05 MEST
sAccessTotal
713991
sRunning
1
name
PUBLIC.STRING:CONVERTTOSTRING
isPrefetched
N
sAccessLast
2013-09-17 03:01:54 MEST
sAccessTotal
961
sRunning
cHitLast
-----------
1) I have data which has more thand 10,000 lines with the above same pattern.
2) I was checking the value of parameter 'sRunning' which should be a numerical value( greater than 1 )
3) Here in the above code the value of parameter(sRunning) is 'cHitLast and in the second case it 1
4) I need to print the above 4 + 1(including sRunning ) values whereever the sRunning has a value greater than 0 ( zero) example shown below
5) Need to ignore if the value of sRunning is other than numerical.
For the above code the output should be as below
name isPrefetched sAccessLast sAccessTotal sRunning
PUBLIC.SERVER:INVOKE N 2013-09-17 15:02:05 MEST 713991 1
This was code given by jotne and it worked for some part but latter am not able to get the desired output.
nawk ' !f{ff=$0; f=1} !x && NR%2 { if(!(f>1 && $0 ~ ff)){printf "%s\t" "\t", $0} if(f==1){f++;next}}
!(NR%2) { d=d" "$0 } $0 ~ ff {print "\n"d; x=1;d=""} END{print d} '
Your help is much appreciated.
Thanks in advance.