在管道中时,您可能还会遇到grep缓冲问题。即,您看不到来自的输出
tail --follow=name file.txt | grep something > output.txt
因为grep会缓冲自己的输出。
对grep使用–line-buffered开关可解决此问题:
tail --follow=name file.txt | grep --line-buffered something > output.txt
如果您希望尽快将以下结果放入output.txt文件中,这将很有用。

在管道中时,您可能还会遇到grep缓冲问题。即,您看不到来自的输出
tail --follow=name file.txt | grep something > output.txt
因为grep会缓冲自己的输出。
对grep使用–line-buffered开关可解决此问题:
tail --follow=name file.txt | grep --line-buffered something > output.txt
如果您希望尽快将以下结果放入output.txt文件中,这将很有用。