7

How to delete original and duplicate line when matching by column using awk?

view full story
linux-howto

http://stackoverflow.com – I have found a partial answer to my question but I can't figure out the rest. I'm using awk. I can delete original and duplicate lines using the following command: awk 'NR==FNR{a[$0]++;next} a[$0]<2' infile infile However this requires the entire line to be duplicated. Does anyone know how to delete the original and duplicate lines when matching by column 1? I tried this awk 'key[$1]; NR==FNR{a[$0]++;next} a[$0]<2' infile infile but that didn't get me anywhere. I have a file with the following type of data: srv13108 f15001:/export/rack131/srv13108 srv13407 f15001:/export/rack134 (HowTos)