Please help me
I have a file abc.txt as,
raj 100 hasan 90
guru 300 anekal 10
guru 180 belgam 80
hamsa 150 mysore 50
janak 325 belgola 25
ganap 221 kailas 21
now my requirement is, I want to sort the file based on the first column
and also for the same first column if there are any duplicates, in such cases
it has to select only the first occurence. Also it has to delete the second
occurence eventhough it is not completely similar except first column.
Consider the above example,
In that my requirement is to select the first occurence for the 'guru' record.
i.e,. output should only display:
raj 100 hasan 90
guru 300 anekal 10
hamsa 150 mysore 50
janak 325 belgola 25
ganap 221 kailas 21
and the second occurance for the 'guru' record should not get extracted.
i.e,. record "guru 180 belgam 80" should not produce.
I've tried with the below sort option:
sort +0 | uniq | abc.txt
But still my output is not as per the above expectation.
Any Help would be much appreciated.
Much Regards,
Ganapati