Lado do servidor:
# nc -l -u -p 666 > /tmp/666.txt
Outro shell do lado do servidor:
# tail -F /tmp/666.txt | while IFS= read -r line; do
echo "$line";
# do what you want.
done;
Lado do cliente:
# nc -uv 127.0.0.1 666
#### Print your commands.