Just to be a little bit picky, the netstat output is slightly different between BSD-like Unix and GNU/Linux.
The port is separated by a dot on the BSD-like Unix. So maybe the pattern matching /:8333/ could be
reviewed to include also the other output... but beside that, this is just fine.
Could you provide a sample few lines of output from a BSD netstat -an?
It would take more than changing the /:8333/ pattern to fix this, if I understand your description
correctly. There is also the awk split on the ":" which would have to be fixed as well. This is all
doable with a little bit of regular expression hacking (something I do easily.) But I should see the
exact BSD netstat -an output first, to be sure I understand it correctly.
I think this could do the trick in awk for the matching : && (/:8333/ || /\.8333/)
and for the split, an if block to match the : and another if block to split on dot. It
will start to be unreadable for an one-liner ;-)
FYI, here is output:
tcp4 0 116 192.168.1.2.8333 18.104.22.168.45167 ESTABLISHED
tcp4 0 0 192.168.1.2.8333 22.214.171.124.29297 ESTABLISHED
tcp4 0 0 192.168.1.2.8333 126.96.36.199.1191 ESTABLISHED
tcp4 0 0 192.168.1.2.8333 188.8.131.52.10100 ESTABLISHED
tcp4 0 0 192.168.1.2.8333 184.108.40.206.10020 ESTABLISHED
tcp4 0 0 192.168.1.2.8333 220.127.116.11.8597 ESTABLISHED
tcp4 0 0 192.168.1.2.8333 18.104.22.168.3328 ESTABLISHED
tcp4 0 0 192.168.1.2.8333 22.214.171.124.3230 ESTABLISHED