in reply to Re: Separate duplicate and unique records
in thread Separate duplicate and unique records

Almost right. sort -u will give one copy of each input record whether it was unique or not to begin with. What he wants is uniq -u and uniq -D since he stated the input was already sorted. My program below does it in one pass, though.

Replies are listed 'Best First'.
Re: Re: Re: Separate duplicate and unique records
by revdiablo (Prior) on Aug 07, 2003 at 23:10 UTC

    Well, sort -u (or simply the default behavior of uniq) matches the behavior of the OP's sample code -- that is, it prints all values once, but only once. Perhaps that is not what he wanted, but if he stated that in his original post, it's not clear to me. Either way, it seems he has many solutions to any number of problems, some of which may be the actual problem he was looking for help with. :)