I have a input file as below.
Code: Select all
Code:
Input file:
Date feild2&3custid FLD-1 FLD-2 FLD-3
20110101 111111 london Real Fraud
20101201 111111 Madrid Real Fraud
20101101 111111 london Real Fraud
20101001 111111 london Ceal Fraud
20100901 111111 london Ceal Secur
20110101 222222 Madrid Real Fraud
20101201 222222 london Real Fraud
20101101 222222 Madrid Real Fraud
20101001 222222 Madrid FCB Fraud
20100901 222222 Madrid FCB M&F
20101101 333333 Madrid Real Fraud
20101001 333333 Madrid Ceal Fraud
20100901 333333 Madrid Beal Fraud
20100901 444444 Madrid Real Fraud
Code: Select all
Code:
Output file:
Date feild2&3custid FLD-1 FLD-2 FLD-3 Comment
20110101 111111 london Real Fraud First Record
20101201 111111 london Real Fraud First Record with date from second record.
20101101 111111 Madrid Real Fraud Second Record with date from 3rd record.
20101001 111111 london Real Fraud Third Record with date from 4th record.
20100901 111111 london Ceal Fraud Fourth Record with date from 5th record.
20110101 222222 Madrid Real Fraud Six'th Record. (First Record for second customer.)
20101201 222222 Madrid Real Fraud Six'th Record with date from 7th record.
20101101 222222 london Real Fraud Seventh Record with date from 8th record.
20101001 222222 Madrid Real Fraud Eight Record with date from 9th record.
20100901 222222 Madrid FCB Fraud Nineth Record with date from 10th record.
20101101 333333 Madrid Real Fraud Ten'th Record. (First Record for Third customer.)
20101001 333333 Madrid Real Fraud Ten'th Record with date from 11th record.
20100901 333333 Madrid Ceal Fraud Eleventh Record with date from 12th record.
20100901 444444 Madrid Real Fraud Twelve'th Record. (First Record for Fourth customer.)
1) Write the first record of every customer Twice. a) First write as it is. b) Second time write the whole record as it is, with date from the below record if the customer is same for both the records.
2) And delete the last record of every customer.
3) But if there is only one record for a customer then write it down to the
output.
Please let me know if i am not clear.
Raul