Find and Replace text in .sql files
You can use sed
for this. sed
stands for S tream Ed itor
sed -i 's/OLDSERVERNAME/NEWSERVERNAME/g' *.sql
- -i option will do in-file substitution.
- g implies global substitution. So if there are more than one instances of OLDSERVERNAME in one line they will get replaced with NEWSERVERNAME
- *.sql will pass all files ending with
.sql
extension.
Look up sed
man page for more details.