equick has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I'm trying to write code to replace the folling text in an xml file
with<!-- <control_link_address>push1.mycompany.com</control_link_address> -->
using perl -npe 's/find/replace/g' -i $file<!-- <control_link_address>push1.mycompany.com</control_link_address> --> <control_link_address>mdp.travel.co.uk</control_link_address>
Here's my code but this doesn't work. :
$find=q[[<control_link_address>push1\.mycompany\.com<\/control +_link_address>\s*\n\s*-->]]; $replace=q[$find\n <control_link_address>mdp.travel.co.uk< +\/control_link_address>\n]; $cmd=qq[perl -npe "s/$find/$replace/g" -i /tmp/ls.conf];
Could someone help me out please?
Thanks, Ed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl regex for xml
by Corion (Patriarch) on Jun 18, 2010 at 13:37 UTC | |
|
Re: perl regex for xml
by graff (Chancellor) on Jun 19, 2010 at 02:00 UTC | |
by equick (Acolyte) on Jun 20, 2010 at 08:44 UTC |