This is the mail archive of the
cygwin-talk
mailing list for the cygwin project.
My pipe flushes late
- From: Robert Schmidt <rschm at broadpark dot no>
- To: cygwin-talk at cygwin dot com
- Date: Wed, 20 Aug 2008 13:54:17 +0200
- Subject: My pipe flushes late
- Reply-to: The Vulgar and Unprofessional Cygwin-Talk List <cygwin-talk at cygwin dot com>
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