TMBUF(1)                                                              TMBUF(1)



NAME
       tmbuf - timed data slicer

SYNOPSIS
       tmbuf [-e] [-seconds] [-t seconds]
       tmbuf -h
       tmbuf -V


DESCRIPTION
       Tmbuf  program  accepts  input  on  stdin  that  might be coming out in
       "spurts".  The output might be from a monitoring program, or from  some
       real  time  data collector.  The program captures a time based slice of
       data from the input then flushes it to the output and exists.

       Because standard UNIX utilities _buffer_ data very well, when  we  need
       to filter a stream, say with grep, as in:
              collect_data | grep -v "hack_this_out" | control_expr

       what we find is that grep(1) will buffer lots of data.  It will in fact
       buffer until enough "good" data has come in to flush its output buffer.

       So  if you get a good "control event" as the first input line you might
       not see it until after a few hundred control events make it through the
       pipeline.  By that time it is way too late.

       If we re-code that as
              collect_data | while tmbuf >slice ; do
                   grep -v "hack_this_out" <slice | control_expr
              done
       then  the process works to feed back in near real time.  Tune the tmbuf
       options for the delay you need.  (Because we've  force  grep  to  do  a
       small window, not wait for more input.)


OPTIONS
       If the program is called as tmbuf then no options are forced.

       -seconds
              Time  to  stall  between  lines (default 5 seconds).  As long as
              lines flow within seconds seconds of  each  other  tmbuf  passes
              them through.

       -e
              Exit nonzero at EOF, even if some input was processed.

       -h
              Print only a bried help message.

       -t seconds
              Total  time  to  delay after first read (default forever).  Even
              though lines are still coming we have to stop  processing  after
              seconds.

       -V
              Show only version information.


EXAMPLES
       tail -0f status | tmbuf -t 30 | Mail -s "found" ksb
              When  the  file status gets some lines appened mail ksb with the
              subject "found", only wait 30 seconds before  sending  the  mail
              after the first line appears.

       conserver -v | pager.ksh
              The  pager  script  uses tmbuf internally to slice the output of
              the console server.

       tmbuf -V
              Output the standard version banner.

BUGS
       There should be an initial timeout, but one can do that in the shell as
       well.

AUTHOR
       KS Braunsdorf
       tmbuf at nospam.ksb.npcguild.org

SEE ALSO
       mailx(1) Mail(1), tail(1), sh(1), Tee(1l), tee(1), conserver(8l)



                                     LOCAL                            TMBUF(1)

NAME | SYNOPSIS | DESCRIPTION | OPTIONS | EXAMPLES | BUGS | AUTHOR | SEE ALSO