newbee1310
Technical User
Hi,
I am having a file(new.sql) containing create table statements(mysqldb), i am trying to modify engine type and other few strings in the last line of each table creation.
I tried the below sed which modified engine type but i need help in removing the default charset and add the connection string.
sed -i 's/ENGINE=InnoDB /ENGINE=FEDERATED /g' new.dmp
Original table
CREATE TABLE `test` (
`column1` varchar(200) NOT NULL,
`column2` varchar(200) NOT NULL,
`BLOB_DATA` blob,
PRIMARY KEY (`column1`,`column2`),
KEY `dummy` (`column1`,`column2`),
CONSTRAINT `test` FOREIGN KEY (`column1`,`column2`) REFERENCES `test2` (`column1`,`column2`)
) ENGINE=InnoDB AUTO_INCREMENT=1948988 DEFAULT CHARSET=utf8;;
Modified table
CREATE TABLE `test` (
`column1` varchar(200) NOT NULL,
`column2` varchar(200) NOT NULL,
`BLOB_DATA` blob,
PRIMARY KEY (`column1`,`column2`),
KEY `dummy` (`column1`,`column2`),
CONSTRAINT `test` FOREIGN KEY (`column1`,`column2`) REFERENCES `test2` (`column1`,`column2`)
) ENGINE=federated AUTO_INCREMENT=1948988 connection='fed_test';
Thanks
Newbee
I am having a file(new.sql) containing create table statements(mysqldb), i am trying to modify engine type and other few strings in the last line of each table creation.
I tried the below sed which modified engine type but i need help in removing the default charset and add the connection string.
sed -i 's/ENGINE=InnoDB /ENGINE=FEDERATED /g' new.dmp
Original table
CREATE TABLE `test` (
`column1` varchar(200) NOT NULL,
`column2` varchar(200) NOT NULL,
`BLOB_DATA` blob,
PRIMARY KEY (`column1`,`column2`),
KEY `dummy` (`column1`,`column2`),
CONSTRAINT `test` FOREIGN KEY (`column1`,`column2`) REFERENCES `test2` (`column1`,`column2`)
) ENGINE=InnoDB AUTO_INCREMENT=1948988 DEFAULT CHARSET=utf8;;
Modified table
CREATE TABLE `test` (
`column1` varchar(200) NOT NULL,
`column2` varchar(200) NOT NULL,
`BLOB_DATA` blob,
PRIMARY KEY (`column1`,`column2`),
KEY `dummy` (`column1`,`column2`),
CONSTRAINT `test` FOREIGN KEY (`column1`,`column2`) REFERENCES `test2` (`column1`,`column2`)
) ENGINE=federated AUTO_INCREMENT=1948988 connection='fed_test';
Thanks
Newbee