[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: piping tail -f through cut
From: |
Micah Cowan |
Subject: |
Re: piping tail -f through cut |
Date: |
Fri, 08 Feb 2008 09:26:04 -0800 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071022) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Pádraig Brady wrote:
> Bob van Loosen wrote:
>> Hi everyone,
>>
>> Whenever I do this:
>>
>> tail -f /var/log/kern.log | cut -f 8- -d " " | dd bs=1
>>
>> I get no output, but when I do this:
>>
>> tail -f /var/log/kern.log | cut -f 8- -d " "
>>
>> I do get output, I'm using coreutils 5.97 on Ubuntu 7.10 64 bit.
>
> I've documented that exact case here:
> http://www.pixelbeat.org/programming/stdio_buffering/
>
> There's a patch for `cut` there,
> which demonstrates how to add this functionality to coreutils.
>
> Personally I think it would be great to add the buffering control
> to glibc, so that most applications would benefit.
> But Ulrich Drepper <sarcasm>in his usual amiable style</sarcasm>
> suggested this was a silly idea.
It is a very silly idea, considering it would violate the C standard
(§7.19.3#7):
As initially opened, the standard error stream is not fully buffered;
the standard input and standard output streams are fully buffered if and
only if the stream can be determined not to refer to an interactive device.
- --
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHrJCs7M8hyUobTrERAj+kAJ9p719TmoPlOgJFHkG9hfio/4GUuwCePVxk
C3ej5YbZadYuyoweKlLZ//M=
=79+4
-----END PGP SIGNATURE-----