menuimage

Description

Options

Examples

Dependencies

Changelog

Download

Donation

My_Other_Sites

My_Programs

Comments

numliststat v0.2 [08 Dec 2022] by Dominic

Description

Returns statistical value(s) for a piped-in list of numbers - integers or decimals, space or line-separated. 6 values (sum count mean median minimum maximum) are output, columnised with a descriptive header; or if one or more of these are added as parameters (case-insensitive and only the first three letters are significant, tot(al) can be used instead of sum and ave(rage) instead of mean) then only the specified value(s) are output, with no header or columnising.

Note the optional -p setting for the maximum number of decimal places in each output result (default: 4). Results are shown with as few decimal places as possible that give an accurate result, subject to the maximum setting. (The calculations are at a much higher level of precision.)

Options

-h see this help
-p maximum decimal places for output value(s) (default: 4)
-l see changelog

Examples

# echo "1 2 3 4 5 10"|numliststat.sh
sum count mean median minimum maximum
25 6 4.1667 3.5 1 10
# echo "1 2 3 4 5 10"|numliststat.sh mean minimum max
4.1667 1 10

Dependencies

awk bash column fold sed

Changelog

0.2 [08 Dec 2022] - bugfix showing full decimal results, add -p option, ignore commas or CRs in input, conform with shellcheck, publish
0.1 [08 Jan 2022] - based on an answer at https://unix.stackexchange.com/questions/13731/is-there-a-way-to-get-the-min-max-median-and-average-of-a-list-of-numbers-in

Download numliststat.sh

Donation

I have provided this software free gratis and for nothing. If you would like to thank me with a contribution, please let me know and I will send you a link. Thank you!

My Other Sites

My Programs

Here is a selection of some (other) programs I have written, most of which run under GNU/Linux from the command line (CLI), are freely available and can be obtained by clicking on the links. Dependencies are shown and while in most cases written and tested on an x86-based Linux server, they should run on a Raspberry Pi, and many can run under Windows using Windows Subsystem for Linux (WSL) or Cygwin. Email me if you have problems or questions, or if you think I could help with a programming requirement.

Backup Utilities

Debian/Ubuntu kernel and LVM Utilities

Miscellaneous Programs

Comments

This section is closed. If you have a question, please submit it by email, thank you.

No comments yet for '/programs/help/numliststat.sh.php'