#!/bin/bash
for file in *.csv
do
awk -F ‘,‘ ‘begin {total=0;sum=0} {total++;if($1<=100.0 && $15!=0) sum++} END{ print FILENAME,"all",total, sum ,sum*1.0/total}‘ $file >> stat1.log
awk -F ‘,‘ ‘begin {total=0;sum=0} {total[$15]++;if($1<=100.0) sum[$15]++} END{for(i in sum) print FILENAME,i,total[i], sum[i] ,sum[i]*1.0/total[i]}‘ $file >> stat1.log
done
sort -n -t ‘ ‘ -k1 -k2 stat1.log -o stat1.log
时间: 2024-12-18 18:14:52