multiple search separated by blank line

hi all

I want to get multiple search that are separated by blank line according to first search in text file

eg: egrep 'x|Y|Z' file

in that for each x...it should be seperated by blank line

will u pls help

grep -B 1 ^$ | egrep 'x|Y|Z' file

^$ for blank line and -B 1 prints blank line and before line

I am not getting pls help

sorry command is

grep -B 1 ^$ file | egrep 'x|Y|Z'

can u post sample data

cat list
DELETE:MD:TM,432350214576013;

RESP:940120105;
DELETE:MD:TM,432350415547447;

RESP:940120105;

SET:NOK:TM,432350110811018:T22,0;

RESP:11000999;
SET:MD:TM,4323500223734641;

RESP:0;
SET:NOK:TM,432350220813251:BAIC,1;
RESP:0;

SET:MD:TM,4323502142003351;

RESP:0;
DELETE:MD:TM,432350415283715;

RESP:0;
DELETE:MD:TM,432350415434001;

RESP:0;
SET:MD:TRIM,989370025055:LANG,English;
RESP:0;

DELETE:MD:TM,432350041977269:TRIM,989371036084;;

RESP:940120105;
SET:MD:TM,432350214483040;

RESP:0;
DELETE:MD:TM,432350021443483:TRIM,989362585071;

RESP:0;

grep -B 1 ^$ list | egrep 'DELETE|SET'
DELETE:MD:TM,432350214576013;
DELETE:MD:TM,432350415547447;
SET:NOK:TM,432350110811018:T22,0;
SET:MD:TM,4323500223734641;
SET:MD:TM,4323502142003351;
DELETE:MD:TM,432350415283715;
DELETE:MD:TM,432350415434001;
DELETE:MD:TM,432350041977269:TRIM,989371036084;;
SET:MD:TM,432350214483040;
DELETE:MD:TM,432350021443483:TRIM,989362585071;

Pls examine this...
grep -B 1 ^$ | egrep 'Enter|@|SQL RUN' dat

Enter value for authid: 560000
SQL RUN TIME--- 22-12-2008 13:57:29
@lienup.sql SELECTED VALUE
Enter value for authid: 560000
SQL RUN TIME--- 22-12-2008 13:57:29
@lienup.sql SELECTED VALUE
...........................................

before.....every first one (ie Enter valur for authid ..)
i should get blank line

thx in advance

cat file

Enter value for authid: 560000
SQL RUN TIME--- 22-12-2008 13:57:29
@lienup.sql SELECTED VALUE
Enter value for authid: 560000
SQL RUN TIME--- 22-12-2008 13:57:29
@lienup.sql SELECTED VALUE

Enter value for authid: 560001
SQL RUN TIME--- 22-12-2008 13:57:30
@lienup.sql SELECTED VALUE
Enter value for authid: 560001
SQL RUN TIME--- 22-12-2008 13:57:30
@lienup.sql SELECTED VALUE

Enter value for authid: 560002
SQL RUN TIME--- 22-12-2008 13:57:40
@lienup.sql SELECTED VALUE
Enter value for authid: 560002
SQL RUN TIME--- 22-12-2008 13:57:40
@lienup.sql SELECTED VALUE

Enter value for authid: 560003
SQL RUN TIME--- 22-12-2008 13:57:50
@lienup.sql SELECTED VALUE
Enter value for authid: 560003
SQL RUN TIME--- 22-12-2008 13:57:50
@lienup.sql SELECTED VALUE

grep -A 3 ^$ file | egrep 'Enter|SQL RUN|@'
Enter value for authid: 560000
SQL RUN TIME--- 22-12-2008 13:57:29
@lienup.sql SELECTED VALUE
Enter value for authid: 560001
SQL RUN TIME--- 22-12-2008 13:57:30
@lienup.sql SELECTED VALUE
Enter value for authid: 560002
SQL RUN TIME--- 22-12-2008 13:57:40
@lienup.sql SELECTED VALUE
Enter value for authid: 560003
SQL RUN TIME--- 22-12-2008 13:57:50
@lienup.sql SELECTED VALUE

or try this grep -A 10 ^$ file | egrep -m 3 'Enter|SQL RUN|@'

A for after
grep -A 3 print three lines

start=1;
grep -n ^$ file | sed s/:// | while read lineno
do
end=$lineno;
cat file | sed -n "$start,$end p" | grep -m 1 Enter
cat file | sed -n "$start,$end p" | grep -m 1 "SQL RUN"
cat file | sed -n "$start,$end p" | grep -m 1 '@'
start=$end
done

i think this may help you. this not efficient method.
the logic is
print lines between two blank lines and grep first occerence of "Enter" , grep first occerence of "SQL RUN" and grep first occerence of "@"

or try this
start=1;
grep -n ^$ file | sed s/:// | while read lineno
do
end=$lineno;
cat file | sed -n "$start,$end p" | egrep -m 3 'Enter|SQL RUN|@'
start=$end
done