题解 | #netstat练习4-输出各个状态的数目#
netstat练习4-输出和3306端口建立连接总的各个状态的数目
https://www.nowcoder.com/practice/5ce76fd1513d4eacae68ad3b2aca1fbb
#!/bin/bash awk -F ':|[ ]+' '/tcp.+\:3306/{ list[$6]++;if($8 ~ /ESTA.+/){a++} b++; } END{ print "TOTAL_IP " length(list); print "ESTABLISHED " a; print "TOTAL_LINK " b; } ' "./nowcoder.txt"