How to remove duplicate records with out sort | Unix Linux Forums | Solaris

  Go Back    


Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

How to remove duplicate records with out sort

Solaris


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-28-2008
svenkatareddy svenkatareddy is offline
Registered User
 
Join Date: Nov 2007
Last Activity: 10 November 2011, 4:02 AM EST
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
How to remove duplicate records with out sort

Can any one give me command How to delete duplicate records with out sort.

Suppose if the records like below:

345,bcd,789
123,abc,456
234,abc,456
712,bcd,789

out tput should be
345,bcd,789
123,abc,456

Key for the records is 2nd and 3rd fields.fields are seperated by colon(,).
Sponsored Links
    #2  
Old 02-28-2008
robotronic's Avatar
robotronic robotronic is offline Forum Advisor  
Can I play with madness?
 
Join Date: Apr 2002
Last Activity: 20 December 2009, 10:56 AM EST
Location: Italy
Posts: 370
Thanks: 0
Thanked 0 Times in 0 Posts
Try this:

Code:
nawk -F',' '!x[$2$3]++' input_file

Sponsored Links
    #3  
Old 02-28-2008
svenkatareddy svenkatareddy is offline
Registered User
 
Join Date: Nov 2007
Last Activity: 10 November 2011, 4:02 AM EST
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks..

It's working
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 somewhat Duplicate records from a flat file jolney Shell Programming and Scripting 4 09-29-2011 04:01 PM
Remove Duplicate Records imipsita.rath Shell Programming and Scripting 6 03-05-2010 10:05 PM
Remove duplicate records svenkatareddy Shell Programming and Scripting 7 03-03-2010 08:46 AM
How to remove duplicate records with out sort svenkatareddy Shell Programming and Scripting 19 06-11-2008 02:10 PM
Remove all instances of duplicate records from the file vukkusila Shell Programming and Scripting 3 12-12-2007 06:50 AM



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