Hi
I have a file
1 xyz 456
1 xyz 456
1 xyz 456
2 abc 8459
3 gfd 657
4 ghf 658
4 ghf 658
I want the output
1 xyz 456
2 abc 8459
3 gfd 657
4 ghf 658
so if first column there is same number duplicated once again , romve the whole next duplicated row.
Please let meknow scripting
perl -lne '$x{$_}++; END{print for(sort keys %x)}' file
Thanks for reply.
But its not providing expected output
as I think its checking by xyz also may be
I want it shuld check only 1
if one is more than once remove the whole row of second 1
so for example
1 xyz 456
1 xyz 456
1 xyz 456
2 abc 8459
3 gfd 657
4 ghf 658
4 ghf 658
5 xyz 456
6 gfd 657
the output shuld be
if xyz is more than once but with number 5 it shuld leave it as it is
1 xyz 456
2 abc 8459
3 gfd 657
4 ghf 658
5 xyz 456
6 gfd 657
Try this:
awk '{s=$0;$1=$1} !a[$0]++{print s}' file