Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Re: Counting lines by content

by willa (Acolyte)
on Oct 09, 2002 at 11:35 UTC ( [id://203896]=note: print w/replies, xml ) Need Help??


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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://203896]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-23 06:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found