On 2022-04-24 03:45, konsolebox wrote: > A command like this doesn't display data: > > tail -f /var/log/messages -n +1 | grep -e something --line-buffered | tail > > probably because the last tail waits for the pipe to terminate. > > But this could work if there exists an option like -S which allows > tail to wait for N seconds before considering input as "stopped" and > then displaying currently absorbed input.
Hi konsolebox, I was inspired by this thread to hack up a little utility called pw (Pipe Watch) over a couple hours late last night. Here is a link to the man page: https://www.kylheku.com/cgit/pw/tree/pw.1 You pipe your input to pw, similarly in concept to a pager. It doesn't behave like a pager though; it maintains a small FIFO of the last bunch of lines of the data source, which are updated to an interactive display. The FIFO is continuously pumping data; the display just takes snapshots. I managed to cram a few features into it, like scrolling left-right over long lines, a suspend mode which freezes the display, and some Vi-like colon commands to save/append what is displayed to a file, or send it to a pipe. If you have time, give it a try. Enjoy! P. S. I have an idea for a new feature also. Since this is basically a kind of data capture device for live input (like an oscilloscope), it would be useful if it had a trigger mode. Instead of time-based refresh, this would look for some pattern in the data to update the display. In logs, there are sometimes repeating patterns (like a periodic signal). If you can lock on to a repeating pattern, you can get it to appear to freeze, so you get a better visual, making it easy to see the parts in the pattern that are changing.