I'm trying to use grep to get a regex result and pipe the results on-the-fly to telnet running an open port to a node server.
The grep received continuous, but varied in interval, commands from a program running, greps out a number then pipes that over telnet. Heres my example attempt:
echo "TEST 1234\r\n" | grep -e "[0-9]{4}" | telnet 127.0.0.1 1234
I can't change the string format of the echo "spoof". The echo without the grep does successfully send the string to telnet. The grep doesn't seem to be sending to stdOut.
I'm expecting telnet to receive data from the pipe like:
1234
7645
8376
Any help to how to achieve this?