题解 | #nginx日志分析6-统计每分钟的请求数#
nginx日志分析6-统计每分钟的请求数
http://www.nowcoder.com/practice/9a37600d342c47ed9e9a0fd33c1c189e
#! /usr/bin/env bash
########################################################
#
#
########################################################
function solution_1() {
cat nowcoder.txt | awk -F":" '{print $2":"$3}' | sort | uniq -c | awk '{print $1,$2,$3}' | sort -nr -k1
}
########################################################
#
#
########################################################
function solution_2() {
awk -F":" '{
a[$2":"$3]++
} END {
for(k in a) {
print a[k],k
}
}' nowcoder.txt | sort -nr -k1
}
solution_2