Question : Parse multiple line entries to produce single line output

Can I use awk or perl or other utility to make one output entry for a line starting with a date and 3 following lines with a filled parameter? so it looks like this?:

02-01-2008 03:34:50 201 0 0 [email protected]
02-01-2008 03:34:50 200 0 0
02-01-2008 03:35:23 201 0 0 [email protected]
02-01-2008 03:37:42 400 12 1

Input file:

[2008.01.02-03:34:50.170] aa.app.lib.Status$Req
[2008.01.02-03:34:50.172] aa.app.lib.Status$Response
header.function=[201]
header.completion=[0]
data.email=[mail@somewhere.com]
header.error=[0]
[2008.01.02-03:34:50.172] aa.app.lib.Status$Response
header.function=[200]
header.completion=[0]
header.error=[0]
[2008.01.02-03:35:23.822] aa.app.lib.Status$Req
[2008.01.02-03:35:23.822] app term server 0
[2008.01.02-03:35:23.823] Conn 1 server
[2008.01.02-03:35:23.856] Term use:1
[2008.01.02-03:35:23.860] aa.app.lib.Status$Req
[2008.01.02-03:35:23.862] aa.app.lib.Status$Response
header.function=[201]
header.completion=[0]
header.error=[0]
[2008.01.02-03:37:42.532] aa.app.lib.Status$Response
header.function=[400]
header.completion=[12]
data.email=[mail@somewhere.com]
header.error=[1]

Answer : Parse multiple line entries to produce single line output

If there are no blank lines between entries, but each entry always starts with a bracketed date:
#!/usr/bin/perl
$/="\n[";
my @k=qw(function completion error);
while( <> ){
    my %h=/^header\.(\w+)=\[(.*?)]/mg;
print "$3-$2-$1 $4 @h{@k} ",/^data\.email=\[(.+)]/m,"\n" if exists$h{function} && exists$h{completion} && exists$h{error} && /\[?(\d+)\.(\d+)\.(\d+)\-([\d:]+)/;
}
Random Solutions  
 
programming4us programming4us