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 <[email protected]>
> To: [email protected]
> 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