awk批量求平均值

 1 #!/bin/bash
 2 #功能:求每列均值,并将所有文件的结果保存到average.txt中
 3 cd met1/
 4 for file in `ls`
 5 do
 6   #filelist[$c]=$file
 7   #c=`expr $c + 1`
 8   #echo $file
 9   time=`expr substr $file 10 14`
10   awk '{a+=$2;b+=$3;c+=$4}END{print '$time',a/NR,b/NR,c/NR}' $file >> ../average.txt
11 done
原文地址:https://www.cnblogs.com/xiongyunqi/p/3735852.html