I had the impression sed wasn’t blocking, because when I do say:
iostat | sed
sed processes the data as it arrives, but when I do
iostat | sed | netcat
Then sed blocks netcat.
Am I right?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
sedwill work in buffered mode when it doesn’t print to a terminal. This means that it will try to fill its internal buffer before doing any processing and output by default.This is done to increase throughput, because normally in a pipe you don’t care about the timing, but want as much data processed in a given time as possible.
Passing
-uto sed will tell it to work unbuffered, therefore working the same way it works when output goes to a terminal.