#!/bin/bash
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
SQLWRITE=0;while read line; do if `echo $line | grep "^USE" 1>/dev/null 2>&1`;then DBNAME=`echo $line | sed -e 's/\`//g' -e 's/\;//g'|awk '{print $2}'`; if [ $DBNAME = "mysql" ] || [ $DBNAME = "information_schema" ]; then SQLWRITE=0;else SQLWRITE=1; echo $DBNAME;fi; if [ $SQLWRITE = 1 ];then NEWDBNAME="nekohayo_${DBNAME}";TMPLINE="USE \`$NEWDBNAME\`;"; NEWLINE=$TMPLINE; fi;else NEWLINE=$line;fi;if [ $SQLWRITE = 1 ]; then echo $NEWLINE;fi;done <./old\ database.sql;