On 5/18/05, Chris Devers <[EMAIL PROTECTED]> wrote: > On Wed, 18 May 2005, Lance Murray wrote: > > > However, what is the syntax if I wanted to just process a text stream > > to stdout?, e.g.: > > > > cat /etc/hosts | perl "s/in_text/out_text/g" > > > > I'm sure the answer is fairly simple. I'd just like to use perl one > > liners in place of awk, cut, grep statements (and get all Perls > > advanced regex capability). > > This is really a shell thing, not a Perl matter: > use '-' as a stand-in for standard input: > > $ cat /etc/hosts | perl "s/in_text/out_text/g" - > > (And you realize, I assume, that this is a Useless Use Of Cat, right? I > assume you're just using this as an example...) > > -- > Chris Devers
Except that produces an error. I think want you're looking for is: $ cat /etc/hosts | perl -pe 's/in/out/g' if you really want to emulate awk, though, you're gogin to need '-a' as well, and '-l' certainly helps. check them out in perlrun. For instance: $ cat /etc/hosts | perl -lane 'print $F[1]' HTH, --jay -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>