Thanks. Nc is a little bit fancy, but nothing compared to perl. It's also installed by default on both linux (my linux, anyway) and osx. However, the nc installed on OSX doesn't have the "-e" "gaping security hole" option compiled in, meaning that those example scripts (or at least the one I looked at) won't work.
I do wish that there was some way to do this without nc though. Maybe the linux proc filesystem enables net access? Oh well, another day...
You're right, network sockets should be part of the filesystem. Arnold Robbins, author of GNU awk, is a fan of Plan 9 which did this the right way. It was probably the motivation for him adding special files to awk, e.g. "/inet/tcp/0/localhost/17921".
$ nc -l -p 17921 &
[1] 31333
$ date | awk '{print NR, NF [greater than sign]"/inet/tcp/0/localhost/17921"}'
P.S. It's annoying that posters should waste their time probing the mark-up's flaws. Is there a description of it anywhere, e.g. what characters vanish, or how to break lines?
"And not using perl or any of that fancy stuff"
I think netcat counts as fancy stuff.
Here's the example scripts netcat is packaged with: http://darwinsource.opendarwin.org/10.3/netcat-4/netcat/scripts/
Powerful little tool.