- 博客(0)
- 资源 (8)
- 收藏
- 关注
bash_SHELL开发教程1-awk
学习bash 开发
#!/bin/bash
awk '{ if(NR>1) print $0 }' /proc/net/tcp | awk 'BEGIN{ FS=" "} { print $2,$3,$4,$5,$8 }' | sed 's/:/ /g' | awk -F" " '
{
if($5="01")
print $1, $2, $3, "ESTABLISHED", $5, $6, $7, $8, $9;
else if($5=="02")
print $1, $2, $3, "SYN_SENT", $5, $6, $7, $8, $9;
else if($5=="03")
print $1, $2, $3, "SYN_RECV", $5, $6, $7, $8, $9;
else if($5=="04")
print $1, $2, $3, "FIN_WAIT1", $5, $6, $7, $8, $9;
else if($5=="05")
print $1, $2, $3, "FIN_WAIT2", $5, $6, $7, $8, $9;
else if($5=="06")
print $1, $2, $3, "TIME_WAIT", $5, $6, $7, $8, $9;
else if($5=="07")
print $1, $2, $3, "CLOSE", $5, $6, $7, $8, $9;
else if($5=="08")
print $1, $2, $3, "CLOSE_WAIT", $5, $6, $7, $8, $9;
else if($5=="09")
print $1, $2, $3, "LAST_ACK", $5, $6, $7, $8, $9;
else if($5=="0A")
print $1, $2, $3, "LISTEN", $5, $6, $7, $8, $9;
else if($5=="0B")
print $1, $2, $3, "CLOSING", $5, $6, $7, $8, $9;
}'
2008-12-29
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人