标题: [原创代码] AWK实现数据处理(AWK太强啦) [打印本页]
作者: Gin_Q 时间: 2020-1-7 20:00 标题: AWK实现数据处理(AWK太强啦)
- #!/bin/bash
- #by author Gan
- file=tes.csv
- awk_shaw(){
- awk -v FS=',' 'BEGIN{printf "%-38s%-10s%-20s%-20s%-20s%-10s\n"," Projects","Number","Average","Sum","Max","Min"}'
- for ((i=2;i<=32;i++))
- do
- awk -v FS=',' -v n=$i '{if(NR==1){begin=$n}}NR>1{sum+=$n;{if(NR==2){los=$n}}{if(los>$n){los=$n}};{max>$n?max=max:max=$n}}{lev=NR-1}END{printf "%-38s%-10d%-20f%-20f%-20f%-20f\n",begin,lev,a=sum/lev,sum,max,los}' $file
- #echo $i
- done
- }
- awk_shaw
复制代码
作者: Gin_Q 时间: 2020-1-7 20:01
- Projects Number Average Sum Max Min
- GPU Temperature (C) [0] (C) 126 66.328220 8357.355770 72.076400 44.373860
- Junction Temperature (C) [0] (C) 126 76.053718 9582.768490 81.801670 44.412440
- Mem Temperature (C) [0] (C) 126 70.212397 8846.762070 78.000010 44.000000
- VR_GFX (C) [0] (C) 126 48.866754 6157.210970 57.000000 32.000000
- VR_SOC (C) [0] (C) 126 47.245050 5952.876340 55.000000 34.000000
- VR_MEM (C) [0] (C) 126 0.000000 0.000000 0.000000 0.000000
- VR_VDDCI (C) [0] (C) 126 0.000000 0.000000 0.000000 0.000000
- Liquid0 (C) [0] (C) 126 0.000000 0.000000 0.000000 0.000000
- Liquid1 (C) [0] (C) 126 0.000000 0.000000 0.000000 0.000000
- PLX (C) [0] (C) 126 0.000000 0.000000 0.000000 0.000000
- Min (C) [0] (C) 126 57.690433 7268.994510 62.053100 41.495690
- GFXCLK Freq [0] () 126 1541.733469 194258.417060 1599.064330 793.179870
- PWM [0] () 126 29.710137 3743.477320 34.089070 0.000000
- FAN Speed [RPM] [0] () 126 1335.723332 168301.139870 1525.808840 170.521380
- Limit PPT0 (W) [0] (W) 126 165.000000 20790.000000 165.000000 165.000000
- Value PPT0 (W) [0] (W) 126 159.806716 20135.646230 165.005650 26.424300
- GFX Activity (%) [0] (%) 126 93.124115 11733.638500 98.354930 0.000000
- PCIe Link Speed (GT/s) [0] (GT/s) 126 8.000000 1008.000000 8.000000 8.000000
- PCIe Link Width [0] () 126 16.000000 2016.000000 16.000000 16.000000
- PCIe Correctable Error [0] () 126 0.000000 0.000000 0.000000 0.000000
- PCIe Uncorrectable Error [0] () 126 0.000000 0.000000 0.000000 0.000000
- PCIe Residency Gen 1 (%) [0] (%) 126 1.663242 209.568480 30.000000 0.000000
- PCIe Residency Gen 2 (%) [0] (%) 126 0.000000 0.000000 0.000000 0.000000
- PCIe Residency Gen 3 (%) [0] (%) 126 98.336758 12390.431530 100.000000 70.000000
- PCIe Residency Gen 4 (%) [0] (%) 126 0.000000 0.000000 0.000000 0.000000
- PCIe Residency L0 (%) [0] (%) 126 100.000000 12600.000000 100.000000 100.000000
- PCIe Residency L0s (%) [0] (%) 126 0.000000 0.000000 0.000000 0.000000
- PCIe Residency L1 (%) [0] (%) 126 0.000000 0.000000 0.000000 0.000000
- Fan PWM reading [%] [0] (%) 126 29.674603 3739.000000 34.000000 0.000000
- mclk[0] (MHz) 126 866.071429 109125.000000 876.000000 0.000000
- sclk[0] (MHz) 126 1533.246032 193189.000000 1624.000000 0.000000
复制代码
作者: huzixuan 时间: 2020-10-4 17:00
[attach]12783[/attach]
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |