cmburns has asked for the wisdom of the Perl Monks concerning the following question:
I have some trouble understanding how to redirect input from one pipe to another. Here is what I want to do:
I open one command and process its output in a while loop. On some condition I open another command inside this while loop and I want its output to appear in the same pipe as the output of the first command.
Ok, here's some pseudo-code to make things a bit more clear:
open INPUT, "some_script |"; while (<INPUT>) { if ($some_condition) { open ">&INPUT", "some_other_script |"; } do_something_with_input(); }
(I know there are missing close and or die statements.) Both scripts run over some period of time and give progress information (like 50% done) as their output, so it's important to monitor output from both scripts simultaneously.
Any ideas? Is this possible?
Thanks alot for your help!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Merging two pipes
by tommyw (Hermit) on Oct 24, 2001 at 14:00 UTC | |
|
Re: Merging two pipes
by Zaxo (Archbishop) on Oct 24, 2001 at 13:52 UTC | |
by cmburns (Acolyte) on Oct 25, 2001 at 01:32 UTC | |
|
Re: Merging two pipes
by jeroenes (Priest) on Oct 24, 2001 at 13:36 UTC | |
|
Re: Merging two pipes
by jj808 (Hermit) on Oct 24, 2001 at 13:34 UTC |