FS
OFS
RS
ORS
awk 'BEGIN{FS="[ ?]"}{a[$6]++}END{for(i in a)print i,a[i]}'
awk 'BEGIN{FS="[ ,]"} $2>="11:11:00" {print}' yst-lbss-api.log
#!/bin/bash for i in $(seq 20) do ptime=`date -d "$(($i-1)) minute 20191001 0950" "+[%Y-%m-%dT%H:%M:%S+08:00]"` ntime=`date -d "$(($i)) minute 20191001 0950" "+[%Y-%m-%dT%H:%M:%S+08:00]"` echo "$ptime - $ntime" awk -v ptime=$ptime -v ntime=$ntime '$4 >=ptime && $4<ntime {a[$NF]++;n++} END{for(i in a)print i,a[i]/n*100"%";print "一分钟总行数"n}' blog echo done
grep -i watchtv tvlook.access.log20191028 | head | awk -F "?|[ ]+" '$4>="[2019-10-28T00:00:00+08:00]" && $4<"[2019-10-28T00:08:00+08:00]" {a[$8]++}END{for(i in a)print i,a[i]}'