command line utility to print statistics of numbers in linux

后端 未结 16 1624
無奈伤痛
無奈伤痛 2020-11-30 18:46

I often find myself with a file that has one number per line. I end up importing it in excel to view things like median, standard deviation and so forth.

Is there a

16条回答
  •  长情又很酷
    2020-11-30 19:21

    Also, the self-write stats, (bundled with 'scut') a perl util to do just that. Fed a stream of numbers on STDIN, it tries to reject non-numbers and emits the following:

    $ ls -lR | scut -f=4 | stats
    Sum       3.10271e+07
    Number    452
    Mean      68643.9
    Median    4469.5
    Mode      4096
    NModes    6
    Min       2
    Max       1.01171e+07
    Range     1.01171e+07
    Variance  3.03828e+11
    Std_Dev   551206
    SEM       25926.6
    95% Conf  17827.9 to 119460
              (for a normal distribution - see skew)
    Skew      15.4631
              (skew = 0 for a symmetric dist)
    Std_Skew  134.212
    Kurtosis  258.477
              (K=3 for a normal dist)
    

    It can also do a number of transforms on the input stream and emit only the unadorned value if you ask it; ie 'stats --mean' will return the mean as an unlabelled float.

提交回复
热议问题