remove duplicate records by considering date and timestamp
Posted: Mon Jun 20, 2016 6:49 pm
Hi
I have 1 file which consist of duplicate records like
Feild1 feild2 date(yyyymmdd) timestamp(hhmmss)
123 ABC 20160620 083938
123 ABC 20160620 053623
145 LMN 20160619 123456
145 LMN 20160620 116712
178 PQR 20160620 051122
178 PQR 20160620 051122
i need to remove duplicate records and write into another file but based on feild1+date+timestamp combination. As shown above, it should consider the latest record.
i.e., the output file must be
Feild1 feild2 date(yyyymmdd) timestamp(hhmmss)
123 ABC 20160620 083938
145 LMN 20160620 116712
178 PQR 20160620 051122
it should write only one record in output file if the date and timestamp is same in input file like record3
Coded
I have 1 file which consist of duplicate records like
Feild1 feild2 date(yyyymmdd) timestamp(hhmmss)
123 ABC 20160620 083938
123 ABC 20160620 053623
145 LMN 20160619 123456
145 LMN 20160620 116712
178 PQR 20160620 051122
178 PQR 20160620 051122
i need to remove duplicate records and write into another file but based on feild1+date+timestamp combination. As shown above, it should consider the latest record.
i.e., the output file must be
Feild1 feild2 date(yyyymmdd) timestamp(hhmmss)
123 ABC 20160620 083938
145 LMN 20160620 116712
178 PQR 20160620 051122
it should write only one record in output file if the date and timestamp is same in input file like record3
(178 PQR 20160620 051122).
Coded