replace the line to add some text

Posted by shantanuo on Stack Overflow See other posts from Stack Overflow or by shantanuo
Published on 2010-04-20T05:28:43Z Indexed on 2010/04/20 5:33 UTC
Read the original article Hit count: 293

Filed under:
|

The MySQL dump backup file has the following line...

# head -40 backup20-Apr-2010-07-32.sql | grep 'CHANGE MASTER TO '
-- CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000068', MASTER_LOG_POS=176357756;

a) I need to complete the statement with the parameters like Master host, user and password.

b) I do also need to remove the comment "--"

The line should look something like this...

CHANGE MASTER TO MASTER_HOST='111.222.333.444', MASTER_USER='slave_user', MASTER_PASSWORD='slave_user', MASTER_LOG_FILE='mysql-bin.000068', MASTER_LOG_POS=176357756;

© Stack Overflow or respective owner

Related posts about sed

Related posts about awk