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.