Replace duplicate columns with values from first occurrence

view story

http://www.unix.com – I've a text file with below values viz. multiple rows with same values in column 3, 4 and 5, which need to be considered as duplicates. For all such cases, the rows from second occurrence onwards should be modified in a way that their values in first two columns are replaced with values as in first occurrence. See the sample input and output copied below Input file: Code: AAA,AAA,1,2,99,981,901,11,14 AAA,AAA,1,2,99,987,907,17,13 AAA,AAA,1,2,99,987,902,12,15 ABC,ABC,1,2,99,983,903,13,16 ABC,ABC,1,2,99,984,904,14,17 ABC,ABC,1,2,99,985,905,15,18 ABC,ABC,1,2,99,986,906,16,19 Output file: (HowTos)