tphyahoo has asked for the wisdom of the Perl Monks concerning the following question:
oneTwoThree.pl prints
filterTwoThree.pl checks lines of input and only prints if they match "two" or "three. I want to run something likeone two three
and have this spit outfilterTwoThree.pl | oneTwoThree.pl
Is there a way I can hook these scripts up in one line of dos? I have never used pipes before but I am beginning to see how they could be useful. I think this might be easier in the unix shell... is it worth installing Cygwin so I can use pipes?two three
Thanks for your wisdom!
#!c:/perl/bin/perl #oneTwoThree.pl use warnings; use strict; print "one\n"; print "two\n"; print "three\n";
UPDATE: Maybe the answer is here: How do I store and manipulate the output from another process?#filterTwoAndThree.pl use warnings; use strict; if (/two|three/) { print $_; }
UPDATE: Thanks RazorbladeBidet. I googled around and found many places that suggested dos pipes were somehow handicapped, but in this case I can get what I want to work with, by adding the -n flag
perl oneTwoThree.pl | perl -n filterTwoAndThree.pl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Process output of one script with another script.
by maard (Pilgrim) on Feb 18, 2005 at 18:53 UTC | |
by dave_the_m (Monsignor) on Feb 18, 2005 at 20:34 UTC | |
|
Re: Process output of one script with another script.
by RazorbladeBidet (Friar) on Feb 18, 2005 at 18:54 UTC |