![如何使用 less 来模仿“tail -f ... | grep ...”?](https://linux22.com/image/157532/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20less%20%E6%9D%A5%E6%A8%A1%E4%BB%BF%E2%80%9Ctail%20-f%20...%20%7C%20grep%20...%E2%80%9D%EF%BC%9F.png)
使用时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 行的管道。
谢谢