My pipe flushes late

Robert Schmidt rschm@broadpark.no
Wed Aug 20 11:55:00 GMT 2008


I basically need to pass some output through d2u, then add a prefix to 
each line.  Most importantly, I need the line to flush through the pipe 
immediately.  However, d2u (or the pipe itself) caches/flushes late.
For example:

$ d2u | sed "s/^/prefix: /"
a
b^D
prefix: a
prefix: b
$

I need to see:

$ d2u | sed "s/^/prefix: /"
a
prefix: a
b^D
prefix: b
$

If I replace d2u with cat above, it flushes each line, but I need d2u.
If I replace d2u with sed s/\x0D//g, the output also flushes late.
I know I can probably write one sed script to replace the above pipe, 
but my prefix is actually not static (should be a time stamp).

How can I accomplish this?

My cygwin is up to date (Aug 20).

Cheers,
Robert



More information about the Cygwin-talk mailing list