coreutils
[Top][All Lists]
Advanced

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

[coreutils] Re: added some options to uniq


From: Pádraig Brady
Subject: [coreutils] Re: added some options to uniq
Date: Sun, 22 Aug 2010 11:14:36 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

On 21/08/10 23:18, Karl Berry wrote:
> Hi Adam,
> 
> Thanks for the code.  I'm cc-ing the coreutils maintainers, who will
> take it from here.
> 
> Date: Fri, 20 Aug 2010 14:31:46 -0600
> From: Adam Blackburn <address@hidden>
> To: address@hidden
> Subject: added some options to uniq
> 
> Hey GNU,
>     I wanted to add a couple of options to the coreutils command 'uniq', so
> I did.
>     I added a -p / --zero-padded option which zero pads the --count so it
> can again be sorted, thus sorting by number of occurances,

sort has a numeric mode which already ignores leading blanks,
so the very common idiom of `uniq -c | sort -n` works as expected.

> and I also add a
> -mN / --min-count=N option which will only print lines that have at least N
> occurances.

That has more merit, though I've not needed it myself ever.
Given that min(x,y) is a fairly arbitrary expression,
I'm inclined to think filtering with awk or equivalent
is more appropriate for this.

min=42
uniq -c | sort -n | awk "\$1 > $min"

cheers,
Pádraig.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]