We help IT Professionals succeed at work.
Get Started

Comparing set of records for a substring match to remove duplicate records

kalyangkm
kalyangkm asked
on
95 Views
Last Modified: 2016-02-18
Hi Folks,

I will have a list of records like this

1111,abdc,D23
2222,ejdk,D67
3333,eeld,D22
1111,rrrr,Z33
2222,ertu,T22

and I need to drop the duplicate record but the one which comes first rather than later and the output should be

1111,rrrr,Z33
2222,ertu,T22
3333,eeld,D22

My approach is to see if there is any way to compare the substring (the first 4 characters) of the string(in this case considering the entire record as string eg: 1111,abdc,D23). But I am not able to visualize how can I ignore the first record and return only second duplicate record. A sample code would also be appreciated.
Comment
Watch Question
IT Business Systems Analyst / Software Developer
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE