Remove duplicate value based on two field $4 and $5 | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

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

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-21-2013
mohan sharma mohan sharma is offline
Registered User
 
Join Date: Feb 2013
Last Activity: 1 March 2013, 1:54 AM EST
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
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....

Last edited by mohan sharma; 02-21-2013 at 04:38 AM.. Reason: code tags...
Sponsored Links
    #2  
Old 02-21-2013
Jotne's Avatar
Jotne Jotne is offline
Registered User
 
Join Date: Dec 2010
Last Activity: 8 April 2014, 11:00 AM EDT
Posts: 1,036
Thanks: 61
Thanked 216 Times in 204 Posts
I seems that this is nearly the same as you have here:
http://www.unix.com/shell-programmin...ue-file-2.html
I may be that your request is difficult to understand, or you does not explain it good enough, since you does not get answer.
Sponsored Links
    #3  
Old 02-21-2013
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Last Activity: 15 April 2014, 5:20 PM EDT
Location: Switzerland - GE
Posts: 5,482
Thanks: 148
Thanked 361 Times in 338 Posts
Jotne you are right, these posts are very similar, or they are not clear at all...
Wondering if we should not merge them...
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Remove duplicate based on Group yale_work Shell Programming and Scripting 2 03-21-2012 08:36 PM
Remove duplicate lines based on field and sort cokedude Shell Programming and Scripting 8 03-18-2012 03:43 PM
Remove lines with duplicate first field ajp7701 Shell Programming and Scripting 7 03-18-2012 11:49 AM
Remove duplicate lines (the first matching line by field criteria) joggdial3000 Shell Programming and Scripting 6 05-03-2010 11:18 AM
How to get remove duplicate of a file based on many conditions reva UNIX for Dummies Questions & Answers 3 02-04-2010 06:53 AM



All times are GMT -4. The time now is 12:14 AM.