bash calculate the standard deviation of a column

C++
# Example usage:
awk '{delta = $1 - avg; avg += delta / NR; mean2 += delta * ($1 - avg); } END { print sqrt(mean2 / NR); }' input_file
# This produces the standard deviation for column 1. Change the 1s to
# whichever column number you want.

# Example usage 2:
awk ‘{delta = $1 – avg; avg += delta / NR; mean2 += delta * ($1 – avg); } END { print sqrt(mean2 / (NR-1)); }’ input_file
# This is the calculation for a sample instead of a population
Source

Also in C++: