Your skill will accomplish
what the force of many cannot
Perl command line search and replaceby Anonymous Monk
|on Jan 05, 2008 at 03:09 UTC||Need Help??|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
just how powerful is this option?
I wish to edit a bunch of .html files inside a directory and basically searching and replacing html coding.
To do this, I plan on using:
perl -pi -e 's/http://www.mydomain.com/script.pl?key=3/http://www.mydomain.com/script.pl?key=4/' /home/name/public_html/html/*.html
Now would the above work if I was to run the command via cron job on a shared hosting environment? I also may be replacing html with quotes inside the search pattern. Do I cancel those out like I would when writing in perl?
I'm going to do this later on with trial and error, but want to make sure if I'm on the right track with what I'm trying to do.