I have duplicate records which I am trying to append a number at the end of the duplicate record name so that it is no longer a duplicate. I am staging this data for a subsequence process.
For Example: I have this records in an array:
This would create an output:
output:
which is still a duplicate. So, I am looking for the Majic trick to get these results:
For Example: I have this records in an array:
Code:
var myArray = ["apple-DUP-DELETE","apple-DUP-DELETE","apple-DUP-DELETE","Orange-DUP-DELETE","Orange-DUP-DELETE"]
for(i=0;i<myArray.length;i++) {
var reName =myArray[i];
renName = reName + 1;\\ something like this which can initiate the incremental increase (number)
gs.log(reName);}
output:
Code:
apple-DUP-DELETE1
apple-DUP-DELETE1
apple-DUP-DELETE1
Code:
apple-DUP-DELETE1
apple-DUP-DELET2
apple-DUP-DELETE3