Yes, we have a command to find the values are minimum, maximum, sum, mean, standard deviation, lines and variance from a file. Stats package is very useful calculate the values.
By default most of the Linux operating system is not available stats package, you need to download and install it in your machine. Just download the package from the link using wget command and untar the file.
$ sudo wget http://web.cs.wpi.edu/~claypool/misc/stats/stats.tgz
$ sudo tar -xf stats.tgz
You will see a directory, then you will run the command below,
Then, move your stats binary file to /usr/local/sbin
$ sudo mv stats /usr/local/sbin/.
Run the command stats and the shows output is Invalid field,
$ sudo stats
Invalid field "" in line 0.000000.
Invalid field "" in line 0.000000.
Invalid field "" in line 0.000000.
I have some values 5000 lines in a file name call foo.txt,
$ sudo cat foo.txt
2.251717
2.221627
0.198922
7.558665
6.941204
....
See the output values from that file.
$ sudo cat foo.txt | stats
Field: 1
lines: 5000
mean: 0.513385839800
variance: 0.006139815111
std dev: 0.078356972320
std err of mean: 0.001108134930
sum: 2566.929199000004
min: 0.336419000000
max: 7.757181000000
Comments (0)