because of what happened in this thread: http://forums.digitalpoint.com/showthread.php?t=24941 I was forced to figure this out again. basically, this is a shell script that will look for all .htm files and replace text within all of them. It's helpful if you have a lot of files and you just need to make a global change to your footer and you maybe didn't think about separating out your footer file or using dreamweaver templates, etc. This will not (I don't think) update text across multiple lines. #!/bin/bsh for file in $(find . -type f -name '*\.htm') do cat $file |sed "s/text-to-replace/replacementtext/g" > $file.new mv $file.new $file done PHP: AN IMPORTANT CAVEAT this will overwrite your file even if sed outputs an error - meaning you could potentially lose data if your sed command is not valid. Test your syntax before using this and backup your files.
Use edit-files-in-place option with some extension to back up the file: -i[SUFFIX], --in-place[=SUFFIX] Not all versions of sed support this, though. J.D.
One of the best global text replacing engines I have ever seen is from abacre.com They have a free trial that can get you through about everything you would need for advanced text replacement. It also does the backup for you. http://www.abacre.com/afr/index.htm