Help!! needed to get the desired output

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.

This is an extremely confused and confusing specification! However, based on your second attempt, try this:

awk     '                       {getline x; A[++i%5]=$0; B[i%5]=x}
         /sRunning/ && x==1     {for (j=i+1;j<i+6;j++) printf "%s\t", A[j%5]; printf "\n"
                                 for (j=i+1;j<i+6;j++) printf "%s\t", B[j%5]; printf "\n"
                                }
        ' file
name    isPrefetched    sAccessLast    sAccessTotal    sRunning    
PUBLIC.SERVER:INVOKE    N    2013-09-17 15:02:05 MEST    713991    1    

Sometimes it is simpler to do your transform in several processes, piped together. First, make it more normal, one record per line, desired fields only, in order. You can debug each process before adding the next. Once it all works, you can often combine it, but it might be more maintainable in pieces.

RudiC,

Not getting any output for the code

Kindly help me for getting the desired output, infact iam trying with different scenarious its not working out.

awk     ' {getline x; A[++i%5]=$0; B[i%5]=x} /sRunning/ && x==1     {for (j=i+1;j<i+6;j++) printf "%s\t", A[j%5]; printf "\n" for (j=i+1;j<i+6;j++) printf "%s\t", B[j%5]; printf "\n" } ' $SCRIPTFILE/memstat.ser4PRD >> $SCRIPTFILE/$SCRIPT.check1

Thanks for your support.

RudiC's solution works for me.

Another variant

awk 'NR%2{h=h?h"\t"$0:$0}!(NR%2){d=d?d"\t"$0:$0}/sRunning/{getline; if($0+0>0){if(!m){print h;m=1} print d"\t"$0} h=d=""}' infile

--ahamed

Maybe he needs nawk ?