For all files in the current directory, change some text

This script iterates all files in the current directory changing a string to another string in each file. Just make sure the TEXT-TO-BE-CHANGED does not contains pound signs (#).

Hope it saves someone some time.


Code
#!/bin/bash

for file in *
    do

        sed 's#TEXT-TO-BE-CHANGED#TEXT-TO-CHANGE-TO#g' <$file >$file.temp
        rm -f $file
        mv $file.temp $file

    done





The Captian
Today they call you "crazy". Tomorrow they call you "ahead of your time."
Global Skywatch Learn about Chemtrails - You're breathing them now!
OnlyTheBestHerbs.com World-class supplements
Mercury Talk Why you are sick.
OneUp Domains Domains, Hosting, Email
1-800-358-4278 (U.S. & Canada)