Remove duplicate value based on two field $4 and $5

Hi All,
i have input file like below...
CA009156;20091003;M;AWBKCA72;123;;CANADIAN WESTERN BANK;EDMONTON;;2300, 10303, JASPER AVENUE;;T5J 3X6;;
CA009156;20091003;M;AWBKCA72;321;;CANADIAN WESTERN BANK;EDMONTON;;2300, 10303, JASPER AVENUE;;T5J 3X6;;
CA009156;20091003;M;AWBKCA72;231;;CANADIAN WESTERN BANK;EDMONTON;;2300, 10303, JASPER AVENUE;;T5J 3X6;;
DE018774;20091003;M;;;29121731;OLDENBURGISCHE LANDESBANK AG;WEYHE B BREMEN;;;;28844;DE;
DE018202;20091003;M;;;26720028;OLDENBURGISCHE LANDESBANK AG;BAD BENTHEIM;;;;48444;DE;
DE018449;20091003;M;;;26520017;OLDENBURGISCHE LANDESBANK AG;MELLE, WIEHENGEB;;;;49303;DE;
CA009156;20091003;M;CWBKCA61;XXX;;CANADIAN WESTERN BANK;EDMONTON;;2300, 10303, JASPER AVENUE;;T5J 3X6;;
CA009156;20091003;M;CWBKCA61;XXX;;CANADIAN WESTERN BANK;EDMONTON;;2300, 10303, JASPER AVENUE;;T5J 3X6;;
CA009156;20091003;M;CWBKCA61;123;;CANADIAN WESTERN BANK;EDMONTON;;2300, 10303, JASPER AVENUE;;T5J 3X6;;

I want unique output based on $4 .
if different branch code is available for same BIC($4) code and one of the branch code($5) is XXX.only one row will be stored and with branch code as XXX .rest of the rows for the BIC code will not be stored.

here $4 is having 3 bic code with same value"CWBKCA61" with diff branch code in $5 and i want only one BIC code($4) with XXX value ...and if XXX is not present in $5 then i need all record..

condition is given is if among all the branch code ($5) for same BIC code($4) "XXX" is not present then i have to print as usual...duplicate value only remove when XXX is present in among all the Branch code for same Bic code...

and if null value is present in $4 and $5(ex->row 4,5,6) then i have to print as usual no need to remove that value..

please help me....

I seems that this is nearly the same as you have here:

I may be that your request is difficult to understand, or you does not explain it good enough, since you does not get answer.

Jotne you are right, these posts are very similar, or they are not clear at all...
Wondering if we should not merge them...