iptables 显示如下的数据格式:
Chain OUTPUT (policy ACCEPT 104K packets, 140M bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:4000
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:4001
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:4002
111 44388 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:4009
我想只显示出口流量非 0 也就是上面第四行的数据,我写以下脚本没效果,不知道哪里错了?
iptables -L -nv |awk ' { if($2 != 0 )} { print $0 }'
Chain OUTPUT (policy ACCEPT 104K packets, 140M bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:4000
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:4001
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:4002
111 44388 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:4009
我想只显示出口流量非 0 也就是上面第四行的数据,我写以下脚本没效果,不知道哪里错了?
iptables -L -nv |awk ' { if($2 != 0 )} { print $0 }'