Re: Are parallel pipes feed by one process possible ?

Top Page
Attachments:
Message as email
+ (text/plain)
+ signature.asc (application/pgp-signature)
+ (text/plain)
Delete this message
Reply to this message
Author: Joseph Sinclair
Date:  
To: Main PLUG discussion list
Subject: Re: Are parallel pipes feed by one process possible ?
The following should work (probably there are other ways as well).
process1 | tee >(process2) | process3

This splits the output of process1 to a named pipe which process2 uses as input and the anonymous pipe into process3.
process2 is in a sub-shell, so it's run in parallel with process3, which is run in parallel with process1 and tee because pipes always run in parallel.


wrote:
> Hi,
>
> I want to do the following:
>
> Btw, I don't know if & meaning I think run processes in background has
> any effect on my question but it's there w/the actual commands so I'm
> adding it. So one process runs and is piped into a second process.
>
> $ process1 | process2 &
>
> Is there a way I can pipe process1 into process3 (and still pipe into
> precess2) ? So process1 runs and process2 and process3 run in parallel
> both feed by process1. So like test.txt file w/content:
>
> a
>
> b
>
> c
>
> ---
> then
>
> $ cat test.txt | grep a
> $ a
> $ cat test.txt | grep c
> $ c
>
> I want cat test.text to feed both greps at the same time and maybe get
> output like:
>
> $ac
>
> I tried the tee command w/no luck. Is there a way to do this on one line
> at one time? Thanks. using Ubuntu w/Bash.
>
> Lee
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>


---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss