Re: [exim] [OT] Need a little bash scripting help

Pàgina inicial
Delete this message
Reply to this message
Autor: Heiko Schlittermann
Data:  
A: exim-users
Assumptes vells: Re: [exim] Need a little bash scripting help [OT]
Assumpte: Re: [exim] [OT] Need a little bash scripting help
Heiko Schlittermann <hs@???> (So 12 Dez 2010 21:02:48 CET):
> Marc Perkel <marc@???> (So 12 Dez 2010 20:16:36 CET):
> > Thanks in advance for answering my off topic question.
> >
> > Looking for a simple way to use sort | uniq in a way that returns only
> > those lines that are duplicate more and say 3 times. A file like:
>
> uniq(1) understands "-c", at least the uniq I use (GNU coreutils 8.5).
> The rest should be simple, you'll get each line prefixed with a count.


Alternativly some other scripting language could help (the list does not
need to be sorted)

<FILE perl -ne '$n{$_}++; END { print grep { $n{$_} >= 2 } keys %n }'


--
Heiko :: dresden : linux : SCHLITTERMAN.de
GPG Key 48D0359B : 3061 CFBF 2D88 F034 E8D2 7E92 EE4E AC98 48D0 359B