My dump file looks something like this ...
- - Current Database: `Batch` - Create Database / *! 32312 if not present / batch / /! 40100 Default Character Set UTF8 Collet UTF 8_bin * /; Use `batch`; - - Table structure for table `bet_job_xcquity` - if empty table 'bat_job_excurity'; SET @saved_cs_client = @@ character_set_client; SET character_set_client = utf8; Make the table 'BAT_JOB_XCUTIONIAN' (`JOB_EXECUTION_ID`) (20) Faucet,` variant 'highness (20) default faucet, I want to change the name of the DB in the table and " Use "statement pd_Batch.
sed 's / batch / pd_Batch /' test.sql The above description will be required, but I will not use any" batch Do not want to change the word. It should only change the word found on the line starting with CREATE DATABASE or USE.
Update: The sub-product of this question is more than one DB in the test.sql file, so the following words are PD _
Batch cash country state currency state
sed '/ create database' | USE / s / batch / pd_Batch / 'Test.sql
Comments
Post a Comment