Sven Severus wrote: > Question 1: > Why do I face different behaviour with "cat -n" and "sed s/e/E/g"? > Are there cygwin related reasons? > Which behaviour should I expect (I know there are buffering > mechanisms for stdout when not connected to a tty, so I tend to > say the buffering behaviour ist the one to expect). > > Question 2: > What can I do to turn off the buffering behaviour and to get the > output lines immediately? > Or is my server script approach inappropriate? What should work > better?
From `mad sed`: -u, --unbuffered load minimal amounts of data from the input files and flush the output buffers more often If you add the -u option, sed will buffer less and write to the pipe more often. I would guess this isn't the default as it's less efficient, but haven't done anything to verify that. I believe `cat` never buffers, but I base this on nothing but instinct. A quick experiment on my handy RHEL box implies this is not Cygwin specific; the following command shows buffering behaviour too: tail -f tmpfile | sed 's/e/E/g' | tee outfile (I'm using the pipelines so I can see what's going on without sed thinking stdin or stdout are a terminal.) -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple