rms.awk

来自「awk scripts awk scripts awk scripts awk 」· AWK 代码 · 共 19 行

AWK
19
字号
# A program to compute the square root of the
# sum of the squares of a set of numbers.
# The set of numbers is provided as input -
# one number to a record.
#
# NR is the current record number.  In the END
# section it is the number of records.

BEGIN {
        sum_of_squares = 0
}
{
        sum_of_squares += $1 * $1
}
END {
        root_mean_square = sqrt(sum_of_squares / NR)
        print root_mean_square
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?