I am trying to find duplicates in a file and once a match is found mark the 1st match with a character or word on the end of the line.
eg my file (test.html) contains the following entries
host= alpha-sfserver1 host= alphacrest3 host= alphacrest4 host= alphactn1 host= alphactn2 host= alphactn3 host= alphactn4 down alphacrest4 I can find the duplicate using the following:- (I use $2 as the duplicate will always be in column 2)
awk '{if (++dup[$2] == 1) print $0;}' test.html It removed the last entry (down alphacrest4) but what I want is to also mark the duplicate entry with a word or character such as:-
host= alphacrest4 acked Any help is most welcome.