如何使用 less 来模仿“tail -f ... | grep ...”?

如何使用 less 来模仿“tail -f ... | grep ...”?

使用时tail -f some/filename,它会等待将更多内容追加到文件中。就像less +F ...

但是,如果我有一个管道,tail -f some/filename | ...例如less +F ... | ... 才不是以同样的方式工作,即等待将内容附加到文件中。它终止了。尽管less手册页说

   F      Scroll forward, and keep trying to read when the end of file is reached.  Normally this command would be used when already
          at the end of the file.  It is a way to monitor the tail of a file which is growing while it is being viewed.  (The behav-
          ior is similar to the "tail -f" command.)

在这种情况下如何使用less- 我不希望它在到达文件末尾时终止。如果这是权衡的话,我真的不介意错过最后 10 行的管道。

谢谢

相关内容