题解 | netstat练习3-输出每个IP的连接数
#!/bin/bash
awk '{
if($1=="tcp"){
split($5,tmp,":")
count[tmp[1]]++
}
}
END{
for (item in count){
print item, count[item]
}
}' nowcoder.txt | sort -k2 -nr
#!/bin/bash
awk '{
if($1=="tcp"){
split($5,tmp,":")
count[tmp[1]]++
}
}
END{
for (item in count){
print item, count[item]
}
}' nowcoder.txt | sort -k2 -nr
相关推荐