"tail -f ... | grep ..."をエミュレートするためにlessをどのように使用できますか?

使用すると、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行を見逃すことは本当に大丈夫です。

ありがとう

ベストアンサー1

おすすめ記事