On Sun, Sep 25, 2011 at 22:06, John R Pierce pierce@hogranch.com 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!