nferraz / st

simple statistics from the command line
MIT License
924 stars 69 forks source link

An option to show just the numbers #2

Closed mrshu closed 11 years ago

mrshu commented 11 years ago

I think it would be beneficial for everyone who tends to use st in some kind of oneliner/bashscript to have an option which would omit the description of values which are being printed on the first line.

wc for instance does this on default but I believe that something like --n could work for switching to numbers only.

What do you think about that? My perl knowledge is rather limited but I'd like to try to implement such an easy feature.

Thanks

nferraz commented 11 years ago

Hi,

If you ask a single value, the output will omit the label.

Examples:

$ seq 1 10 | st --count
10

$ seq 1 10 | st --sum
55

$ seq 1 10 | st --mean
5.5

The labels are only shown if you request two or more statistics:

$ seq 1 10 | st --summary
min q1 median q3 max
1.00 3.50 5.50 7.50 10.00

In this case you'd probably need to skip the first line (using tail -n1) and split the values.

Anyway, I think it will be good to add a --no-header option. (The -n option is a sinonym of --count)

nferraz commented 11 years ago

Done!