Reputation: 365
I want to transfer first field of a file. I am using awk to pull the first field and then send it using netcat. But I don't get anything on the otherside. I am using the following command
awk -F, '{print $1}' sample.csv | netcat -lk 9999
Any hints would be much appreciated.
Regards, Laeeq
Upvotes: 1
Views: 353
Reputation: 5815
I ran into this same problem when piping awk output to netcat. Turns out, awk buffers a lot.
Text can be flushed on each line with the fflush() command. The following works for me:
awk -F, '{print $1} fflush()' sample.csv | netcat -lk 9999
Upvotes: 1