Forum Moderators: phranque
----------------------
Script 1 (doesn't work)
----------------------
system ('cd [full Unix path to the directory http://www.example.com/documents/BackgroundNotes/TEST/ goes here];find * -name \'1831pf.shtml\' ¦ xargs perl -pi -e "s/\<body\>.*\<\!\-\-\#include virtual\=\"\/cgi\-bin\/Banner\_BackgroundNotes\.pl\" \-\-\>\<br\>/\<body style \= \"margin\-top\: 1px\; padding\-top\: 1px\;\"\>\n\n\<p style \= \"text\-align\: center\; margin\-top\: 1px\; padding\-top\: 1px\;\"\>\n\<a href \= \"http\:\/\/www\.example\.org\"\>\n\<img style \= \"margin\-bottom\: 20px\; border\: none\;\" src \= \"http\:\/\/www\.example\.com\/images\/Banner\_BackgroundNotes\.gif\"\>\n\<\/a\>\n\<\/p\>\n\n\<br\>/s;"');
----------------------
Script 2 (works)
----------------------
$Direc = [full Unix path to the file http://www.example.com/documents/BackgroundNotes/TEST/1831pf.shtml goes here]";
open(IN, $Direc);
@file = <IN>;
close IN;
$Webpage = join ("", @file);
$Webpage =~ s/\<body\>.*\<\!\-\-\#include virtual\=\"\/cgi\-bin\/Banner_BackgroundNotes\.pl\" \-\-\>\<br\>/\<body style = \"margin\-top: 1px\; padding\-top: 1px\;\"\>\n\n\<p style = \"text\-align: center\; margin\-top: 1px\; padding\-top: 1px\;\"\>\n\<a href = \"http:\/\/www\.example\.org\"\>\n\<img style = \"margin\-bottom: 20px\; border: none\;\" src = \"http:\/\/www\.example\.com\/images\/Banner_BackgroundNotes\.gif\"\>\n\<\/a\>\n\<\/p\>\n\n\<br\>/s;
open(LOG, ">$Direc");
print LOG "$Webpage";
close(LOG);
-----------------------
The first script worked only when I shortened the regex to just replace the word "head" with a different word, but if the long regex works in the second script, I don't see why it won't work in the first.
[edited by: jdMorgan at 2:31 am (utc) on July 25, 2005]
[edit reason] No URLs, please. See Terms of Service. [/edit]