user@yourbox /home/httpd/html ] $ ls *.html *.asp | while read file;do newfile="$file.fixed";sed s/\.html/\.asp/ $file > $newfile;done #### #!/usr/local/bin/perl -w use strict; use cwd; # open our current directory opendir(DD,".") or die("Cannot open ". getcwd ."\n"); # read our files getting only files named *.html # and *.asp my @FILES = grep(/(\.html|\.asp),readdir(FD)) or die ("Could not get directory listing: $!\n"); # close our directory descriptor close(DD); # walk our array that has the file names in it we should go through. while ( @FILES ) { my $file = $_ ; my $newfile = "$file.fixed"; # open two descriptors # FD for our original files open(FD,$file) or die("Cannot open $file\n"; # NEW for our newly created (hopefully fixed) files. open(NEW,">>$newfile") or die ("Cannot open $newfile for writing\n"); # walk each file while ( ) { chomp; # replace anything in a line with