Noame has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
Please advice How can I retrieve and replace text in one Perl line. I retrieve "napre" & "jupiter" strings from GPPRegistry file (As describe below), and want in the same Perl line to replace those texts in the file to "Text1" & Text2":
perl -ne "print if /\bnapre/i || /\bjupiter/i" GPPRegistry.temp.reg
I wrote some sketch, but currently it's doesn't "work":
perl -ne "print if /\bnapre/i || /\bjupiter/i;" -ne "s/napre/Text1/gi +;" GPPRegistry
Please adviec.
Thanks.
20071119 Janitored by Corion: Removed font tags, colors, added formatting, code tags, as per Writeup Formatting Tips
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Retrieve & Replace strings in one Perl line.
by moritz (Cardinal) on Nov 12, 2007 at 20:26 UTC | |
by johngg (Canon) on Nov 12, 2007 at 23:00 UTC | |
by Noame (Beadle) on Nov 13, 2007 at 08:06 UTC | |
|
Re: Retrieve & Replace strings in one Perl line.
by tuxz0r (Pilgrim) on Nov 12, 2007 at 20:50 UTC |