Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Html Tags > Re: Replace hea...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 4 Topic 371 of 447
Post > Topic >>

Re: Replace head tag

by "Jim Michaels" <jmichae3@[EMAIL PROTECTED] > Feb 3, 2006 at 01:36 AM

you could do this with a regular expression in Perl. it's much simpler if
it 
is all on 1 line. (you don't use the m in front of the search string)
I think the search and replace line would look something like
use IO::File;
$FH1=100;
$FH2=101;
open(FH1, "r<myfile.html") or die "can't open file. $!";
open(FH2, "w>newfile.html") or die "can't create file. $!";
while (<FH1>) {
    $_ =~ s/<[hH][eE][aA][dD] .*>/<head>/g;
    print FH2 $_;
}
close(FH1);
close(FH2);

why not take this to the Perl group?
many editors also handle regular expressions, such as The Semware Editor, 
which is fairly cheap. (semware.com)

<out@[EMAIL PROTECTED]
> wrote in message 
news:c1svk1hkoatosnrqrtmrvdqujdt9hkt7at@[EMAIL PROTECTED]
> Hello,
>
> I have a website and I want to replace the head tag in all the pages
> with a new and better one.
> Some pages on my current site have meta data in the head tag and some
> do not.
> Is there a way of doing this "automaticly" (batch) without edit every
> page manually?
>
>
> Jon
>
>
>
>
>
>
 




 4 Posts in Topic:
Replace head tag
out@[EMAIL PROTECTED]   2005-10-14 19:56:58 
Re: Replace head tag
Skot Njordulf <necrowu  2005-12-05 06:07:02 
Re: Replace head tag
"Jim Michaels"   2006-02-03 01:36:42 
Re: Replace head tag
"Jim Michaels"   2006-02-03 12:26:26 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Oct 16 0:26:04 CDT 2008.