I process a file content with awk. I would like to pipe the output of awk into netcat, that communicates with a socket.
The awk script is very simple, it just prints $1.
When I pipe the result of awk into netcat, I have no result printed (except the value of addresses_file).
echo "$addresses_file"
echo $(awk -f http-awk-check.awk $addresses_file | netcat -U /home/hduser/socket/rtop12)
Output
../keys/addresses-2021-01-26-17-44.txt
However, I have a result printed when I try with one line by command line:
$ echo 'info' | netcat -U /home/hduser/socket/rtop12
{"jsonrpc":"2.0","id":1,"result":"0x0"}
The awk script:
BEGIN {
FS = ","
}
{
print $1 "\n" # same result with and without \n
}
How can I get a result similar to the manual command line with my little script ?