2

I'm using a processing tool that reads a file and outputs a modified version of it.

I have been working with it successfully like this:

tail -15f log_file.log | log_colorizer

But I would also like to know how to pipe its live-updates to less:

tail -15f log_file.log | log_colorizer | less -R +F

although it's giving me a hard time, as it doesn't seem to be working. What am I doing wrong? Doing a simple less +F log_file.log seems to work fine.

Thanks

  • 2
    What am I doing wrong? You're using a file-based pager designed to work on seekable files and feeding it an unknowable amount of data from an unseekable pipe. Not surprisingly, there are numerous open bugs related to trying to do that - an indication that paging pipe output is using less in a way it wasn't originally designed to do. It's like using a hammer to drive a screw. – Andrew Henle May 8 '17 at 13:21
  • @AndrewHenle No, it's not like using a hammer to drive a screw. Most (if not all) features of less could be made available for pipes too. It's just that people using less with pipes do not even bother to raise issues. For instance I raised bug 300 – The F command does not work on piped input. – only last year although less exists since year 1985. – Piotr Dobrogost Jul 31 '17 at 20:18
  • @PiotrDobrogost Most (if not all) features of less could be made available for pipes too. How? Pipes are not seekable, and don't generate a known amount of data. less is unable to seek to a previous location to reread data when reading from a pipe, and it can't skip over data to a known location to access contents there. It can't search the entire contents of a pipe because the entire contents aren't available. There are numerous features that are impossible to make available for pipes. – Andrew Henle Jul 31 '17 at 22:39

Browse other questions tagged or ask your own question.