[Bioperl-l] how to use pipe in perl script?
    Zhou Yu 
    zhouyuwhu at hotmail.com
       
    Tue Apr 20 08:04:44 EDT 2004
    
    
  
Thankls to all! I know what to do with your help!
<html><div><STRONG><FONT color=#ff0033 size=4>Best wishes! 
<BR><BR></FONT>Yu Zhou</STRONG></div></html>
>From: Heikki Lehvaslaiho <heikki at ebi.ac.uk>
>To: Paulo Almeida <paulo.david at netvisao.pt>, Zhou Yu 
<zhouyuwhu at hotmail.com>,   bioperl-l at bioperl.org
>Subject: Re: [Bioperl-l] how to use pipe in perl script?
>Date: Tue, 20 Apr 2004 10:42:08 +0000
>
>Zhou,
>
>My guess is that Andreas answered the right question but did not give 
enough
>details.
>
>I remember being confused on how to read from STDIN in perl. Here is an
>example oneliner that demonstates it. It helps if you remember that 
structure
>while(<>){...} can be invoked by using -n to perl:
>
>perl -le 'for (1..10) {print $_}' | perl -nle 'print "item 
$_"'
>
>	-Heikki
>
>On Monday 19 Apr 2004 11:54, Andreas Kahari wrote:
> > Another solution for another interpetation of the problem:
> >
> > If you want to do something like
> >
> >     script1.pl | script2.pl
> >
> > Then script1.pl should write it's results to standard output
> > (<STDOUT>, the default for e.g. print()), and script2.pl 
should
> > read its input from standard input (<STDIN>).  And that's 
all
> > there is to it.
> >
> >
> > Andreas
> >
> > On Mon, Apr 19, 2004 at 12:30:48PM +0100, Paulo Almeida wrote:
> > > You can use the 'system' command to do something like this:
> > >
> > > system("program1 -infile filename | program2");
> > >
> > > If that doesn't work for some reason, you could write the 
output of the
> > > first program to a file, and then open it with the second 
program.
> > >
> > > system("program1 -infile filename > output");
> > > system ("program2 < output");
> > >
> > > I hope that's what you wanted, I'm not sure I understood...
> > > -Paulo Almeida
> > >
> > > Zhou Yu wrote:
> > > >Hi,
> > > >
> > > >How to use pipe in a script, like redirecting the output 
of a program
> > > >to another program in a script?
> > > >
> > > >For example, I use this command "program1 -infile 
filename | program2"
> > > >in the command line, and how can I to do this in a 
script?
> > > >
> > > >Thanks!
> > > >*
> > > >Yu Zhou*
> > >
> > > _______________________________________________
> > > Bioperl-l mailing list
> > > Bioperl-l at portal.open-bio.org
> > > http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
>--
>______ _/      _/_____________________________________________________
>       _/      _/                      http://www.ebi.ac.uk/mutations/
>      _/  _/  _/  Heikki Lehvaslaiho    heikki_at_ebi ac uk
>     _/_/_/_/_/  EMBL Outstation, European Bioinformatics Institute
>    _/  _/  _/  Wellcome Trust Genome Campus, Hinxton
>   _/  _/  _/  Cambs. CB10 1SD, United Kingdom
>      _/      Phone: +44 (0)1223 494 644   FAX: +44 (0)1223 494 468
>___ _/_/_/_/_/________________________________________________________
>_______________________________________________
>Bioperl-l mailing list
>Bioperl-l at portal.open-bio.org
>http://portal.open-bio.org/mailman/listinfo/bioperl-l
_________________________________________________________________
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£  http://www.hotmail.com  
    
    
More information about the Bioperl-l
mailing list