You sent your message to bug-textutils which may indicate that you have a very old version. The current programs are in the coreutils package and would have directed you to the bug-coreutils mailing list. The current stable version is 5.94. But that won't change anything for the purposes of your problem.
ftp://ftp.gnu.org/gnu/coreutils/coreutils-5.94.tar.gz (7.6MB) ftp://ftp.gnu.org/gnu/coreutils/coreutils-5.94.tar.bz2 (4.9MB) Scott Griffith wrote: > I am not sure if this is as designed, but the following produce results > that you would not expect: I think standard I/O file buffering is the reason here. > cat /var/log/messages | grep -i fail | cut -f 9- -d ' ' The 'cat' exits and buffers are flushed, the grep exits and buffers are flushed. The cut writes to a tty and so output is not buffered. > using the following produces nothing, yet it should continually yield > the above messages when watching the system log: > > tail -f /var/log/messages | grep -i fail | cut -f 9- -d ' ' I think they would, if you waited long enough, generated enough input to fill a large I/O buffer and allow the data to be written out. But until that happens the data is in a standard I/O buffer pending more input. > however, I am able to use the following command and get output: > > tail -f /var/log/messages | grep -i fail In this command 'grep' writes to a tty instead of a pipe. The C stdio library does not buffer when writing to a tty because it assumes a user is there. But when writing to anything else, file or pipe, it does buffer. Try this: tail -f /var/log/messages | grep --line-buffer -i fail | cut -f 9- -d ' ' > cat /var/log/messages | grep -i fail | cut -f 9- -d ' ' By the way... You don't need 'cat' in your above example. Just use grep, remove the extraneous process, and redirect the input from the file directly. grep -i fail < /var/log/messages | cut -f 9- -d ' ' Also, because logs tend to get rotated by the system, you might want to look at the tail follow options. Try --follow=name so that it can follow the rotations of the log file. tail --follow=name /var/log/messages | grep --line-buffer -i fail | cut -f 9- -d ' ' Hope that helps, Bob _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils