global replace...

Hi,

I have a dir containing many shell scripts. Each of these shell scripts state a database name (always the same), which I need to change to be a new database.

grep <database name> * brings back all the lines containing the database name. However, I need to change them to be something else.

Is there an easy way around this? or is it better to create a new dir area and use sed somehow?

Very new to all this? Can't find simple answer to match the simple query....

:cool:

From the directory which has the scripts, run this.

for file in *
do
sed -e 's/EXISTING_DB_NAME/NEW_DB_NAME/g' $file > $file.tmp
mv $file.tmp $file 2> /dev/null
done

vino