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

T

Tamara

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.
 
G

gnari

Tamara said:
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
 
M

Michele Dondi

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top