hotgrep

Sometimes you need to do a tail -f, grep the results, and then nuke the file and start all over again... wouldn't it be nice if you could just run a single command to do it, and optionally have it serve the output up on a port?

Hotgrep does just that! And the file can be deleted, moved, recreated, truncated... all during a single hotGrep session.

Example command line:

   hotgrep /that/file/over.there '.+' 3

Which will tail -f the file, returning all new lines, and checking every 3 seconds for new data.

Argument 1 is the filename.

Argument 2 is the regexp pat applied to lines, only lines that match are returned (deafult is .+, which matches all lines).

Argument 3 is the delay in seconds between updates (if not provided defaults to 2 seconds).

Argument 4, if provided, is the port to run the server on.

UNIX only.

http://inferno.slug.org/wiki/HotGrep


The recipe [L1 ] in the Book ActiveState Tcl Cookbook shows how to emulate "tail -f" in Tcl. It achieves platform independence by doing as little as possible. Combining that with hotGrep would provide a platform-independent solution.