我正在使用 -f 标志跟踪日志文件。然后我将它传递给 grep,以仅查找包含“X”的行。这工作得很好。现在我想再次将它传送到另一个 grep 中,这将删除所有包含“Y”的行。当我添加第二个管道时,文件停止刷新,看起来没有数据到来。
这是有效的命令: tail -f my_file.log | grep "X"
tail -f my_file.log | grep "X"
这是没有的命令: tail -f my_file.log | grep "X" | grep -v "Y"
tail -f my_file.log | grep "X" | grep -v "Y"
我应该如何构造它以便命令起作用?
command-line grep
command-line ×1
grep ×1