脚本内容:
[neo@gateway yuebao]$ cat t1.sh
#!/bin/awk -f
{
sum+=$0;
}
END {
printf("%s used value:\n%f\n",FILENAME,100-sum/NR);
}
文本内容:
[neo@gateway yuebao]$ cat 4A-cpu-yuebao-10.txt
97.02
87.41
99.81
98.2
98.94
90.03
99.93
96.89
99.79
99.91
99.7
74.97
执行结果:
[neo@gateway yuebao]$ ./t1.sh 4A-cpu-yuebao-10.txt
4A-cpu-yuebao-10.txt used value:
4.783333
阅读(1294) | 评论(1) | 转发(0) |