Wassercrats
07-23-2005, 07:56 AM
Here's the weekend edition of my column.
This command doesn't find and replace what it should:find * -name '*.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\.unicef\.org\"\>\n\<img style = \"margin\-bottom: 20px\; border: none\;\" src = \"http:\/\/www\.polisource\.com\/images\/Banner_BackgroundNotes\.gif\"\>\n\<\/a\>\n\<\/p\>\n\n\<br\>/s;"I tested the regex on my home PC with the following code, and it worked:$test = "<body>\n\n<!--#include virtual=\"/cgi-bin/Banner_BackgroundNotes.pl\" --><br>\n<b><i>Bureau of Western Hemisphere";
print "-------------------$test--------------------\n\n\n";
$test =~ 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\.unicef\.org\"\>\n\<img style = \"margin\-bottom: 20px\; border: none\;\" src = \"http:\/\/www\.polisource\.com\/images\/Banner_BackgroundNotes\.gif\"\>\n\<\/a\>\n\<\/p\>\n\n\<br\>/s;
print "-------------------$test--------------------\n\n\n";The problem might be that my command exceeded the allowable length. Could someone remind me what the limit is?
P.S. Yes, I was in the correct directory when it didn't work.
This command doesn't find and replace what it should:find * -name '*.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\.unicef\.org\"\>\n\<img style = \"margin\-bottom: 20px\; border: none\;\" src = \"http:\/\/www\.polisource\.com\/images\/Banner_BackgroundNotes\.gif\"\>\n\<\/a\>\n\<\/p\>\n\n\<br\>/s;"I tested the regex on my home PC with the following code, and it worked:$test = "<body>\n\n<!--#include virtual=\"/cgi-bin/Banner_BackgroundNotes.pl\" --><br>\n<b><i>Bureau of Western Hemisphere";
print "-------------------$test--------------------\n\n\n";
$test =~ 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\.unicef\.org\"\>\n\<img style = \"margin\-bottom: 20px\; border: none\;\" src = \"http:\/\/www\.polisource\.com\/images\/Banner_BackgroundNotes\.gif\"\>\n\<\/a\>\n\<\/p\>\n\n\<br\>/s;
print "-------------------$test--------------------\n\n\n";The problem might be that my command exceeded the allowable length. Could someone remind me what the limit is?
P.S. Yes, I was in the correct directory when it didn't work.