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

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to