Skip to main content
3 of 6
added 6 characters in body; edited title; deleted 1 characters in body
Peter.O
  • 33.8k
  • 32
  • 120
  • 167

Is there a way to get the min, max, median, and average of a list of numbers in a single command?

I have a list of numbers in a file, one per line. How can I get the minimum, maximum, median and average values? I want to use the results in a bash script.

Although my immediate situation is for integers, a solution for floating-point numbers would be useful down the line, but a simple integer method is fine...

Peter.O
  • 33.8k
  • 32
  • 120
  • 167