Is that what the data looks like, or are the lines actually really long?
---------- Post updated at 11:06 AM ---------- Previous update was at 10:50 AM ----------
Will the process name always be NEWOLUF2?
---------- Post updated at 11:16 AM ---------- Previous update was at 11:06 AM ----------
Here's what I have so far, assuming the long lines were wrapped accidentally. It's much, much, much easier to write when you know what you're supposed to be operating on 
$ cat begintrans.c
#include <stdio.h>
#include <string.h>
int main(void)
{
char buf[16384];
int transcount=0, elapsetotal=0;
while(!feof(stdin))
{
int newoluf=0, elapsetime=-1;
char timestamp[64]={0};
buf[0]='\0'; // Blank out buffer
while(strcmp(buf, "BEGINTRANS\n") != 0) // look for BEGINTRANS
if(fgets(buf, 16384, stdin) == NULL)
break; // EOF
if(feof(stdin)) break;
while(strcmp(buf, "ENDTRANS\n") != 0) // Look for ENDTRANS
{
const char *tsstr;
if(fgets(buf, 16384, stdin) == NULL)
break;
if(strstr(buf, "NEWOLUF2") != NULL)
newoluf=1;
if(tsstr=strstr(buf, "Timestamp"))
sscanf(tsstr, "Timestamp <%[^>]>", timestamp);
if(strncmp(buf, "ElapseTime", 10) == 0)
sscanf(buf, "ElapseTime <%d>", &elapsetime);
}
if((elapsetime>=0) && (timestamp[0]))
{
transcount++;
elapsetotal += elapsetime;
printf("trans %d, elapsetime %d, timestamp %s\n",
transcount, elapsetime, timestamp);
}
}
printf("Average elapsetime is %d\n", elapsetotal / transcount);
return(0);
}
$ gcc begintrans.c -o begintrans
$ ./begintrans < data
trans 1, elapsetime 745, timestamp 14Sep1111-07-37
trans 2, elapsetime 765, timestamp 14Sep1111-07-37
trans 3, elapsetime 579, timestamp 14Sep1111-07-37
trans 4, elapsetime 356, timestamp 14Sep1111-07-38
trans 5, elapsetime 651, timestamp 14Sep1111-07-41
trans 6, elapsetime 292, timestamp 14Sep1111-07-42
trans 7, elapsetime 345, timestamp 14Sep1111-07-52
Average elapsetime is 533
$