Hi,
I have a log file which has sessionids in it, each block in the log starts with a date entry, a block may be a single line or multiple lines. I need to sed (or awk) out the lines/blocks with that start with a date and include the session id.
The files are large at several Gb.
My example file is :
$> cat test
Date1;stuff;sessionid1;stuff;restofline1
Date2;stuff;sessionid1;stuff;restofline2
Something1;stuff
Something2;stuff
Date3;stuff;sessionid2;stuff;restofline3
Date4;stuff;sessionid2;stuff;restofline4
Date5;stuff;sessionid1;stuff;restofline5
Date6;stuff;sessionid2;stuff;restofline6
my required output would be :
Date1;stuff;sessionid1;stuff;restofline1
Date2;stuff;sessionid1;stuff;restofline2
Something1;stuff
Something2;stuff
Date5;stuff;sessionid1;stuff;restofline5
I am totally unsure how to use the N command to process multiple lines between say regex "^Date.*;sessionid1;" and "^Date" but I think thats the direction I need to be going.
I'm using ksh on Solaris
Any help would be very much appreciated.