Delete Duplicate Column Enteires

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
puneet
Posts: 2
Joined: 31 Aug 2016 09:56

Delete Duplicate Column Enteires

#1 Post by puneet » 31 Aug 2016 10:39

Hi guys,
I need a help writing a Batch file to solve an issue, I have no experience writing these commands.
I have a .csv file which contains duplicate column entries

ROW CODE Status StatusDate EMAIL COL5
1 1234 REL 2/11/2016 6:18 ABC@G.com NEVADA US
2 1234 REL 2/11/2016 6:10 ADE@G.com NEVADA US
3 9856 CNF 9/18/2016 10:00 OkC@G.com SWITZERLAND CH
4 5879 MCNF 1/28/2016 12:00 yey@G.com FRANCCE FR

Above table do not contain duplicate entries but duplicate column entries i.e. Row1 and Row 2, for CODE 1234, these entries differ only in StatusDate.

My requirement if to sort the Table on the base on CODE and StatusDate and remove the first entry i.e. entries whose StatusDate is earlier.
[ delete Row 2 and Keep Row 1 as StatusDate of ROW2 is earlier than ROW1 ]

Please help resolving these issue.

Thanks,

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Delete Duplicate Column Enteires

#2 Post by Squashman » 31 Aug 2016 12:50

If this is a CSV file where are the commas?

This would be easy enough to do in Excel. Sort by your date and time column and then chose the remove duplicates option.

puneet
Posts: 2
Joined: 31 Aug 2016 09:56

Re: Delete Duplicate Column Enteires

#3 Post by puneet » 31 Aug 2016 14:14

the table is in csv(comma separated), I have only posted the example how my Table look like.
I want to do this using Batch job as I have this csv file stored at server and I will be picking up using Dell Boomi Tool which will push the data to Salesforce.
In Boomi I have to use Program Command option which will run this Job. That's why I ask If anyone can help me with Batch job.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Delete Duplicate Column Enteires

#4 Post by Squashman » 31 Aug 2016 14:27

puneet wrote:the table is in csv(comma separated), I have only posted the example how my Table look like.

Please post an exact representation of your data with the commas.

SIMMS7400
Posts: 546
Joined: 07 Jan 2016 07:47

Re: Delete Duplicate Column Enteires

#5 Post by SIMMS7400 » 31 Aug 2016 14:27

Use Notepad or download Notepad++ and edit the file with either platform and then copy into DosTips. Your commas will be retained.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Delete Duplicate Column Enteires

#6 Post by foxidrive » 04 Sep 2016 17:51

puneet wrote:the table is in csv(comma separated), I have only posted the example how my Table look like.


Squashman's point is an important one puneet.

Programming code performs exact operations so if the format of the csv file is different from the example then the code you get will very often not work.

See here: viewtopic.php?f=3&t=6108

Post Reply