in reply to Re: Counting lines by content
in thread Counting lines by content

Thanks - I also need to make sure there are no duplicates in the third field. I assume this is easy too...

Replies are listed 'Best First'.
Re: Re: Re: Counting lines by content
by broquaint (Abbot) on Oct 09, 2002 at 11:45 UTC
    This will count the second field ignoring duplicates
    perl -F: -e 'END { print "$_ $c{$_}\n" for keys %c }' \ -ane '$c{$F[1]}++ unless $d{"@F[1,2]"}++'
    I assume this is what you meant no duplicates in the third field.
    HTH

    _________
    broquaint

      Thanks! Works a treat!