[Top][All Lists]

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

Re: add "min" and "max" to coreutils?

From: Pádraig Brady
Subject: Re: add "min" and "max" to coreutils?
Date: Thu, 2 Jul 2009 10:36:48 +0100
User-agent: Thunderbird (X11/20071008)

Joshua Bronson wrote:
> I was looking for a command line utility to get the min and max from a file
> (rather than the much less efficient "sort | {head,tail} -1") and I couldn't
> find one. Someone on linuxquestions.org directed me toward the Generic
> Mapping Tools <http://gmt.soest.hawaii.edu/>, which provide a "minmax"
> utility, and though it would get the job done it's not exactly what I was
> looking for (not to mention I have no need for the ~60 other utilities in
> the package).

Yes, http://gmt.soest.hawaii.edu/gmt/doc/gmt/html/man/minmax.html is a
bit complicated and not very generic.
Perhaps http://suso.suso.org/programs/num-utils/ would be
more appropriate for you?

> As the provider of "sort", would coreutils be the appropriate
> package to provide "min" and "max" tools with a similar interface (e.g.
> accepting "-n" and such)?

That's an interesting suggestion. I'm not sure about separate tools,
especially considering the num-utils package above. Though perhaps
adding --{head,tail} options to sort would be appropriate as one could
then use a O(n*m) algorithm in sort where m is the parameter to --head
and n is the number of input lines. Also it would be a lot more memory
efficient and one would get the key processing functionality of sort.
I'm not sure about doing that at all though.


reply via email to

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