[comp.unix.questions] reverse-tee, or, merging stdout's

rjshaw@ramius.llnl.gov (Robert Shaw) (04/12/91)

Hi.

Is there any way to do the "reverse" of a tee? meaning that I want two streams
merged into one, without using files. For example, how do I run 

prog1 arg1 arg2 
 and
prog2 arg3 arg4 arg5

and "pipe" prog1's stdout, followed by prog2's stdout into prog3?

I want this:

prompt% prog1 arg1 arg2 > tmp1
prompt% prog2 arg3 arg4 arg5 > tmp2
prompt% cat tmp1 tmp2 | prog3

without using the filesystem.

(email, please)

Thanx, all!

===============================================================================
 Rob Shaw                                              rjshaw@ocfmail.llnl.gov
===============================================================================

ian@rathe.cs.umn.edu (Ian Hogg) (04/20/91)

In article <819@llnl.LLNL.GOV> rjshaw@ramius.llnl.gov (Robert Shaw) writes:
>Hi.
>
>Is there any way to do the "reverse" of a tee? meaning that I want two streams
>merged into one, without using files. For example, how do I run 
>
>prog1 arg1 arg2 
> and
>prog2 arg3 arg4 arg5
>
>and "pipe" prog1's stdout, followed by prog2's stdout into prog3?
>
>I want this:
>
>prompt% prog1 arg1 arg2 > tmp1
>prompt% prog2 arg3 arg4 arg5 > tmp2
>prompt% cat tmp1 tmp2 | prog3
>

  Maybe this will work:

  prog1 arg1 arg2 | (cat ; prog2 arg3 arg4 arg5) | prog3

>without using the filesystem.
>
>(email, please)
>
>Thanx, all!
>
>===============================================================================
> Rob Shaw                                              rjshaw@ocfmail.llnl.gov
>===============================================================================


-- 
Ian Hogg                        email:  ian@rathe.cs.umn.edu
                                        ...!umn-cs!rathe!ian
Rathe, Inc                              ianhogg@cs.umn.edu
366 Jackson Street              phone:  (612) 225-1401

lewis@tramp.Colorado.EDU (LEWIS WILLIAM M JR) (04/21/91)

In the Bourne shell:

	(prog1 arg1 arg2; prog2 arg1 arg2) | prog3

Everything enclosed in () is treated as one as far as stdin and stdout are
concerned.

jim@segue.segue.com (Jim Balter) (04/22/91)

In article <1991Apr19.182517.199@rathe.cs.umn.edu> ian@rathe.cs.umn.edu (Ian Hogg) writes:
>  Maybe this will work:
>
>  prog1 arg1 arg2 | (cat ; prog2 arg3 arg4 arg5) | prog3

and maybe it won't.  If you have doubts, why not try it before posting?

What will work are

   prog1 arg1 arg2 | (cat - ; prog2 arg3 arg4 arg5) | prog3

and

   ( prog1 arg1 arg2 ; prog2 arg3 arg4 arg5) | prog3

rearl@gnu.ai.mit.edu (Robert Earl) (04/22/91)

In article <7204@segue.segue.com> jim@segue.segue.com (Jim Balter) writes:

|   In article <1991Apr19.182517.199@rathe.cs.umn.edu> ian@rathe.cs.umn.edu (Ian Hogg) writes:
|   >  Maybe this will work:
|   >
|   >  prog1 arg1 arg2 | (cat ; prog2 arg3 arg4 arg5) | prog3
|
|   and maybe it won't.  If you have doubts, why not try it before posting?
|
|   What will work are
|
|      prog1 arg1 arg2 | (cat - ; prog2 arg3 arg4 arg5) | prog3

I fail to see a difference between these two.  `cat' with no arguments
implies `cat -'.  At any rate, this second one is the obvious way to
do it, and is what I suggested in email:

| ( prog1 arg1 arg2 ; prog2 arg3 arg4 arg5) | prog3


--robert
<rearl@gnu.ai.mit.edu>
<rearl@watnxt3.ucr.edu>

jim@segue.segue.com (Jim Balter) (04/24/91)

In article <REARL.91Apr22025829@nutrimat.gnu.ai.mit.edu> rearl@gnu.ai.mit.edu (Robert Earl) writes:
>In article <7204@segue.segue.com> jim@segue.segue.com (Jim Balter) writes:
>|   >  prog1 arg1 arg2 | (cat ; prog2 arg3 arg4 arg5) | prog3
>|
>|      prog1 arg1 arg2 | (cat - ; prog2 arg3 arg4 arg5) | prog3
>
>I fail to see a difference between these two.  `cat' with no arguments
>implies `cat -'.

Right.  I hallucinated.