I have input file like below.
I00789524 0213 5212
D00789524 0213 5212
I00778787 2154 5412
The first two records are same(Duplicates) except I & D in the first character. I want non duplicates(ie. 3rd line) to be output. How can we get this . Can you help. Is there any single AWK or SED command.
Do you need it to be awk/sed?
[rick@kangaroo ~]$ cat test.dat
I00789524 0213 5212
D00789524 0213 5212
I00778787 2154 5412
[rick@kangaroo ~]$ uniq -u -s1 test.dat
I00778787 2154 5412
[rick@kangaroo ~]$
Thanks for your quick reply. Happy with that.If it can be handled in awk or SED, please let me know.
One way with awk:
awk 'NR==FNR{a[substr($0,2)]++;next} a[substr($0,2)]==1' file file
Regards