--- db/prgsrc/changecities.pl 2000/10/17 15:05:48 1.1 +++ db/prgsrc/changecities.pl 2000/10/17 15:33:46 1.2 @@ -16,7 +16,7 @@ C by C for e in the ChangeLog -=back 4 +=over 4 =item B<-c> ChangeLog @@ -26,13 +26,37 @@ Location of the ChangeLog file Directory of html files -=over +=back =head1 AUTHOR Boris Veytsman -=head1 $Id: changecities.pl,v 1.1 2000/10/17 15:05:48 boris Exp $ +=head1 $Id: changecities.pl,v 1.2 2000/10/17 15:33:46 boris Exp $ =cut + use strict; +use vars qw($opt_c $opt_d); +use Getopt::Std; + +getopts('c:d:') or die "Wrong arguemnts"; +open (CHANGELOG, $opt_c) or die "Cannot open ChangeLog $opt_c"; +chdir $opt_d or die "Cannot chdir to $opt_d"; +while () { + chomp; + next unless (/->/); + m/^\s*(\S*)\.txt\s*->\s*(\S*)\.txt/ or print "Bad line: $_"; + my $oldname=$1; + my $newname=$2; + print "Changing $oldname to $newname\n"; + open(FILES, "grep -l \'tour=$oldname\' *.html|"); + while() { + chomp; + my $file = $_; + print "CONVERTING $file."; + `perl -iorig -p -e 's/tour=$oldname/tour=$newname/g' $file`; + print "..\n"; + } +} +