new interactive utility: pw ("Pipe Watch").

5 views
Skip to first unread message

Kaz Kylheku

unread,
Apr 28, 2022, 6:35:53 PMApr 28
to
Hi All,

I wrote an interative utility called "pw". This works similarly to a
pager:

yourcommand | pw

Man page and git repo: https://www.kylheku.com/cgit/pw/tree/pw.1

Just like an interative pageer such as "less", Like a pager, pw reads
lines from standard input and provides a display. However, it has
a different paradigm. "pw" keeps only a small FIFO buffer of lines
in memory (default 15), which is continuously updating. You cannot go
back in history. "pw" updates the display whenever a period of input
inactivity occurs (default 1s), or else once every lnog interval (10 s).

Platforms: I built this on Solaris 10, GNU/Linux, Mac OS. It compiled
on OpenBSD, but something is wrong. The tiny Makefile needs gmake.

"pw" offers

- horizontal scrolling through long lines (h, l keys or arrows).
- suspend/resume: freeze the display, while the FIFO keeps running.
- Vi-like commands:
:w file # save display to file
:a file # append display to file
:! cmd # pipe display to command

- Built in "grep stack":
:g regex # allow only lines matching regex into the FIFO
:v regex # allow only lines not matching regex into the FIFO
- patterns accumulate into a stack:
:r # pop most recent pattern from stack
:r! # pop all patterns

- trigger mode (like a scope!) to "freeze" recurring patterns:
/pattern # synchronize bottom line in display to pattern
?pattern # synchronize top line in display to pattern

- history recall and editing for : commands and /, ? trigger
patterns. (Ctrl-P, Ctrl-N or arrows).
- very basic editing: backspace, Ctrl-W, Ctrl-U.

To get started, try:

tcpdump -i <if> | pw

you will be surprised at how you can drill down into things.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Reply all
Reply to author
Forward
0 new messages