Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unix command 'tail' lost option '--line-buffered'

With the last update of our SuSE Enterprise Linux 11 (now bash 3.2.51(1)-release), the command "tail" seems to have lost its option to stream files:

tail: unrecognized option '--line-buffered'

Our tail is from "GNU coreutils 8.12, March 2013". Is there another, equivalent solution?

like image 538
Alexander Schäl Avatar asked Aug 14 '13 08:08

Alexander Schäl


1 Answers

As far as can be told by simple googling, tail doesn't appear to have a --line-buffered option, grep does. --line-buffered is useful to force line buffering even when writing to a non-TTY, a typical idiom being:

tail -f FILE | grep --line-buffered REGEXP > output

Here the point of --line-buffered is to prevent grep from buffering output in 8K chunks and forcing the matched lines to immediately appear in the output file.

tail -f is unbuffered regardless of output type, so it doesn't need a --line-buffered option equivalent to the one in grep. This can be verified by running tail -f somefile | cat and appending a line to the file from another shell. One observes that, despite its standard output being a pipe, tail immediately flushes the newly arrived line.

like image 189
user4815162342 Avatar answered Sep 26 '22 02:09

user4815162342