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.
Well, darn.
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 80.217.82.59.45167 ESTABLISHED
tcp4 0 0 192.168.1.2.8333 68.103.101.19.29297 ESTABLISHED
tcp4 0 0 192.168.1.2.8333 79.184.79.110.1191 ESTABLISHED
tcp4 0 0 192.168.1.2.8333 61.94.216.38.10100 ESTABLISHED
tcp4 0 0 192.168.1.2.8333 113.22.164.48.10020 ESTABLISHED
tcp4 0 0 192.168.1.2.8333 85.232.113.117.8597 ESTABLISHED
tcp4 0 0 192.168.1.2.8333 46.109.12.201.3328 ESTABLISHED
tcp4 0 0 192.168.1.2.8333 62.103.58.117.3230 ESTABLISHED