peet(1)

NAME
peet - piped reverse tee: read from many file descriptors and copy to one

SYNOPSIS
peet [-h] [-b size] [-w outfd] infd1 [infd2 ...]

DESCRIPTION
peet reads from many file descriptors and copies everything to one file descriptor. If no file descriptor is given ('-w' option), 1 (stdout) is used.

peet without the -b option reads the data which is available on each fd and writes it out to the output file descriptor. For each input fd one read is executed. This reads maximum 4096 bytes at once. For each read one write is executed. This means that the output data might be scattered randomly between the different input streams.

When the -b option is specified, the number is seen as bytes in a block. A write is executed only of complete blocks on the input buffer.

peet can be used with pipexec(1) to de-multiplex text based output.

OPTIONS

-h  print help and version information

-b num
    Reads always num bytes before writing them.

-w outfd
    use the given outfd as output file descriptor. If this option is not specified, 1 (stdout) is used.

EXAMPLES
Read from stdin (fd 0), and file descriptors 9 and 11 and write to stdout.
    peet 0 9 11

Using pipexec(1): start two commands, both write their log to stdout and use one instance of rotatelogs(1) to write the logs to disk into a common log file: (The file descriptors 8 and 11 are chosen by random.)
    pipexec [ CMD1 /usr/bin/cmd1 ] [ CMD2 /usr/bin/cmd2 ] \
      [ PEET /usr/bin/peet 8 11 ] \
      [ RLOGS /usr/bin/rotatelogs /var/log/%Y%m%d_cmd.log ] \
      "{CMD1:1>PEET:8}" "{CMD2:1>PEET:11}" \
      "{PEET:1>RLOGS:0}"

SEE ALSO
pipexec(1), peet(1), rotatelogs(1), tee(1)

AUTHOR
Written by Andreas Florath (andreas@florath.net)

COPYRIGHT
Copyright © 2015,2023 by Andreas Florath (andreas@florath.net). License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.