News for hackers. Stuff that matters.
Re:Learn to use Awk with hundreds of examples by asicsp on Wednesday October 25, 2017 @10:42AM (#15550503)
No need so many commands :)

    $ cat duplicates.txt
    abc  7   4
    food toy ****
    abc  7   4
    test toy 123
    good toy ****

    $ awk '!seen[$2]++' duplicates.txt
    abc  7   4
    food toy ****

    $ awk '!seen[$2]++{cnt++} END{print +cnt}' duplicates.txt
    2
Re:Learn to use Awk with hundreds of examples by kazinator on Wednesday October 25, 2017 @02:00PM (#15552423)
On a large file with many duplicates, seen[x]++ can overflow, unless you're using GNU Awk with bignums (gawk -M).
Re:Learn to use Awk with hundreds of examples by asicsp on Wednesday October 25, 2017 @10:05PM (#15555817)
that's a good point

I'll add a note, thanks :)