perl -pi -00 -e 's{().*?(<\/TITLE>)}[$1newtitle$2]gis' *.html #### while(<>) { ..... } #### perl -pi -e 's{^#!\/.*?$}[#!\/usr\/bin\/perl];' *.pl