If you need numerical stability, I'd use Gary Perlmann's [|stat](http://oldwww.acm.org/perlman/stat/history.html). It's older and somewhat harder to get a copy of, but it's as reliably correct as a piece of software can be...
One suggestion: whatever the default may be, give an option to have line-delimited output rather than column-delimited.
IMHO if you want your script's output to be easily usable by other scripts, line-delimited is easier since you can grep out what lines you want rather than having to rely on the column position never changing (since you can give cut only a field number and not a field name like "average").
I wanted to use "stat", but it was already used (display file status); "statistics" was too big.
Just as curiosity, I got the idea for this script when I wanted to calculate the sum of some numbers and discovered that the "sum" command was used for another purpose (display file checksums and block counts)!
maybe you are not aware of it, but there is a nifty little tool in freebsd called ministat that somewhat overlaps with what you did, maybe of interest:
Lovely! As someone with my own little script to sum up the values in a given column, I can see how you'd want to just have this tool sitting ready to hand in ~/bin in wherever. And this script seems to adhere better to the Unix way than mine, since it's easy to use cut(1) to extract whatever column you want, but it makes sense for one tool to do sum, mean, sd, etc. Thanks for sharing!
Nice, is there a maximum rowcount? What would be nice is a way to do a sum on a second or third column - or would you use awk to get those and pipe the result to st?
So, http://suso.suso.org/programs/num-utils/index.phtml already exists and is written in perl. It seems like your major contribution is a statistical slant, which might be compatible with the existing code base.
edit: it's perl, not python. brainfart on my part.
why not write a one line python program instead? I'd never use the shell for these kinds of things. Quickly they grow into more than something that a simple one liner can handle. Before you know it, you're reading from a CSV and summing column "foo" and so on. This then turns your shell approach into mess, instead of a (now 5 line) python program.
imurray|12 years ago
nferraz|12 years ago
https://github.com/nferraz/st/commit/d0fb1bf814fc5940c5aae39...
Doches|12 years ago
Sprint|12 years ago
nferraz|12 years ago
The reason I wrote this script was to get quick results from the command line.
For instance: I could use grep, cut and other unix tools to get the numbers from a file and make quick calculations.
Of course, for complex processing I would use octave or R.
asgeirn|12 years ago
philsnow|12 years ago
IMHO if you want your script's output to be easily usable by other scripts, line-delimited is easier since you can grep out what lines you want rather than having to rely on the column position never changing (since you can give cut only a field number and not a field name like "average").
sprayk|12 years ago
http://st.suckless.org/
nferraz|12 years ago
I wanted to use "stat", but it was already used (display file status); "statistics" was too big.
Just as curiosity, I got the idea for this script when I wanted to calculate the sum of some numbers and discovered that the "sum" command was used for another purpose (display file checksums and block counts)!
riffraff|12 years ago
http://www.freebsd.org/cgi/man.cgi?query=ministat&apropos=0&...
codemac|12 years ago
I converted this tool to linux for the archlinux package forever ago:
https://github.com/codemac/ministat
There are a few forks (adding autoconf, an osx branch, etc) as well.
nferraz|12 years ago
pjungwir|12 years ago
fsiefken|12 years ago
nferraz|12 years ago
The calculation of median and quartiles require that the whole set is stored and later sorted, so it is limited to the available memory.
Regarding your suggestion -- I'm considering the idea of dealing with multiple columns and even CSV and other types of tabulated data.
nidoran|12 years ago
jldugger|12 years ago
edit: it's perl, not python. brainfart on my part.
unknown|12 years ago
[deleted]
montecarl|12 years ago
https://github.com/SamChill/hist
hnriot|12 years ago
unknown|12 years ago
[deleted]