#!/usr/bin/perl #All credit for this goes to O'Reilly Perl Book. # This one line script does the equivalent of SED, in a loop for all files #in a directory. It even makes a backup copy first of each file before , it #changes it in place. # The SED command would be: # sed 's/converttolinux.com/localhost/g' printer.html > new_printer.html # That is replacing the "converttolinux.com" string with the "localhost" # string globally. #We must make the process iterative, that is for each file in the directory. #The -pi switch does this additionally making up a backup copy of each # *.html file with the .bak extension appended to it. # Enjoy! as usual it takes a lot longer to explain this then to write it. perl -pi.bak -e 's/converttolinux.com/localhost/g' *.html ## End of Perl Script