Lance Murray wrote:
Hello:
Hello,
I've long used Perl's "in place edit" feature, and understand it and regex
fairly well, e.g.:
perl -i -p -e "s/oldhostname/newhostname/g" /etc/hosts
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).
Well, you can't use the -i switch because there is no "file" to edit:
cat /etc/hosts | perl -pe"s/in_text/out_text/g"
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>