I have a requirement where I have to identify duplicates from a file based on the first 6 chars (It is fixed width file of 12 chars length) and whenever a duplicate row is found, its original and duplicate row's last 2 chars should be updated to all 0's if they are not same. (I mean last 2 digits of original and duplicate row should be same, if not then default to 00 else keep them as is)
I can use multiple loops and get the results but I would need something which will be faster
here is the sample input and output
output should be:
1231126N1214 (Since last 2 digits are same nothing changed)
Any help in achieving the above result using either awk/sed will be greatly appreciated.