当前位置:网站首页>awk statistical average max min
awk statistical average max min
2022-08-04 19:34:00 【HongDaYu】
#!/bin/awk -f
BEGIN {
min=0
max=0
diff=0
avg=0
sum=0
cnt=0
}
{
# cals diff find max min avg
diff=$6-$4
sum=sum+diff
cnt=cnt+1
if(NR == 1){
min = diff
max = diff
}
if(min > diff){
min = diff
}
if(max < diff){
max = diff
}
}
END {
avg=sum/cnt
printf("min: "min" max: "max" avg: "avg" cnt: "cnt"\n")
}
边栏推荐
猜你喜欢
随机推荐
我的四周年创作纪念日
Internship: changed the requirements
红外图像滤波
PG网络传输安全SSL介绍及使用示例
TritonVM——基于Recursive STARK的虚拟机
手把手教你CSP系列之script-src
Chrome 开发者工具 performance 标签页的用法
[Sql刷题篇] 查询信息数据--Day1
Storage resource activation system to help new infrastructure
零基础做出高端堆叠极环图
工业相机CCD与CMOS
Redis数据库—定义、特点、安装、如何启动与停止
SOA面向服务架构:服务、服务实例、ARXML、服务接口调用以及各参与方
SAP UI5 确保控件 id 全局唯一的实现方法
MMDetection 使用示例:从入门到出门
T+Cloud: A "Smart Company" for Building New Business Social Networks and Marketing Relationships
如何给MySQL添加自定义语法 ?
Finished product upgrade program
宏定义小方法
Query the published version records of the APP Store