Re: Sort logfiles on common lines?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Sun, Sep 25, 2011 at 22:06, John R Pierce <pierce@xxxxxxxxxxxx> wrote:
>> Is there a way to get the most common (unique) lines of the file?
>
> sort -k 3 | uniq -f 2
>
>
> which will sort starting at field 3, and then print lines that are
> unique, skipping the first 2 fields, where fields by default are blank
> separated.
>

Thanks, John. This looks to me that it will sort alphabetically, not
by commonness. For instance:
ERROR b
ERROR a
ERROR b

Since "ERROR b" was reported more often than "ERROR a", I would prefer
that the output be:
ERROR b
ERROR a

I'm sorry for not making that so clear! Is there a good word for "most
common" or "used most often" that would be concise in this context?

Thanks!

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux