我想得到
的输出tail -f /var/log/apache2/error.log | grep "trace1"
放入文件中。但
tail -f /var/log/apache2/error.log | grep "trace1" > output.txt
不起作用,而第一个命令在我的终端窗口中给出了预期的输出。
我猜它与follow-参数有关,因为如果我省略"-f",则创建输出文件。
但是为什么会这样,我怎样才能实现我的目标呢?
问候,阿克塞尔
你能不能试试:
tail -f /var/log/apache2/error.log | grep "trace1" | tee -a output.txt