Pipe the output of a command to script 
Author Message
 Pipe the output of a command to script

I am looking to pipe the output of a command to a script, like grep foo
|./perl.pl.
process the output of the grep in the perl script.
Does IO::Pipe handle this?
I just don't no where to start to look for this


Tue, 27 Jan 2004 22:14:47 GMT  
 Pipe the output of a command to script
Uh ... I got it next time "poke it with a stick" a little more before I post

while (<STDIN>){.....}
if any one has another way please post it.


Quote:

> I am looking to pipe the output of a command to a script, like grep foo
> |./perl.pl.
> process the output of the grep in the perl script. Does IO::Pipe handle
> this?
> I just don't no where to start to look for this



Tue, 27 Jan 2004 22:26:22 GMT  
 Pipe the output of a command to script

Quote:
>I am looking to pipe the output of a command to a script, like grep foo
>|./perl.pl.
>process the output of the grep in the perl script.
>Does IO::Pipe handle this?
>I just don't no where to start to look for this

perldoc perlopentut

and check out the section "Pipe Opens" or use backticks, i.e.
my $grep = `grep foo bar`;

HTH,
--
Thomas Baetzler - http://baetzler.de/ - Clan LoL - http://lavabackflips.de/
I am the "ILOVEGNU" signature virus. Just copy me to your signature.
This post was infected under the terms of the GNU General Public License.



Tue, 27 Jan 2004 22:33:30 GMT  
 Pipe the output of a command to script

Quote:

> I am looking to pipe the output of a command to a script, like grep foo
> |./perl.pl.
> process the output of the grep in the perl script.
> Does IO::Pipe handle this?
> I just don't no where to start to look for this


while( my $line = <> ) {
        # do stuff with $line
Quote:
}

__END__

Or using perl's builtin grep:

while( my $line = <> ) {
        next if !/pattern/;
        # do stuff with $line

Quote:
}

__END__

Using an appropriate builtin (if one exists) is almost invariably faster
than using an external program.

--
I need more taglines. This one is getting old.



Wed, 28 Jan 2004 08:31:01 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. piping command output to open()

2. capturing output of piped commands

3. Help with Piped command, capturing output

4. Sendmail won't pipe output to perl script

5. Piping output from one script into another

6. piping server output through a pipe

7. Piping to script w/ command line arguments

8. Piping problem running perl script from NT command line

9. output shows up in piped output file, but not on homepage

10. Telnet module and perl script to telnet to remote, perform commands and log output

11. HELP: Piping shell command into perl command?

12. capturing command line error or output from `<command>`

 

 
Powered by phpBB® Forum Software