Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > change meta tag description in all htm documents including all files in subdirectories

Reply
Thread Tools

change meta tag description in all htm documents including all files in subdirectories

 
 
Tamara
Guest
Posts: n/a
 
      04-06-2004
How can I change meta tag description in all htm documents including all
files in subdirectories, with using perl on Windows XP?
E.g. new meta tag is "New meta tag", and I want change it in all htm file
including htm files in subdirectories.



 
Reply With Quote
 
 
 
 
gnari
Guest
Posts: n/a
 
      04-06-2004
"Tamara" <> wrote in message
news:c4v3ve$2es$...
> How can I change meta tag description in all htm documents including all
> files in subdirectories, with using perl on Windows XP?
> E.g. new meta tag is "New meta tag", and I want change it in all htm file
> including htm files in subdirectories.
>


use File::Find;

gnari



 
Reply With Quote
 
 
 
 
Michele Dondi
Guest
Posts: n/a
 
      04-07-2004
On Tue, 6 Apr 2004 22:30:13 +0200, "Tamara" <>
wrote:

>How can I change meta tag description in all htm documents including all
>files in subdirectories, with using perl on Windows XP?
>E.g. new meta tag is "New meta tag", and I want change it in all htm file
>including htm files in subdirectories.


It is not clear at all what you want to do, but in any case File::Find
seems the way to go, as another poster already suggested. OTOH this is
not an help desk, however please see if you can adapt the following
minimal example to your needs:

#!/usr/bin/perl

use strict;
use warnings;
use File::Find;

my @dirs=grep { -d or !warn "`$_': no such directory!\n" } @ARGV;
die "Usage: $0 <dir> [<dirs>]\n" unless @dirs;

@ARGV=();

find { no_chdir => 1,
wanted => sub {
push @ARGV, $_
if /\.html?$/ and -f;
} }, @dirs;

$^I = '.bak';
s|(</?)meta-tag>|$1actual-tag>|g, print while <>;

__END__


Michele
--
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
"perl bug File::Basename and Perl's nature"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rename *-ch03.htm to ch03-*.htm? robertchen117@gmail.com Perl Misc 6 02-06-2007 08:59 AM
meta redirect - on removing .htm extension, Firefox displays HTML - Why? David Smithz HTML 6 04-30-2006 04:46 PM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
[JSP]: Including HTM files Ralf Koms Java 1 10-11-2004 05:42 PM
Including .htm files conditionally? Sten Westerback ASP General 2 02-03-2004 05:14 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57