INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

AWK help required

AWK help required

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close