Replace string in big sql file (15 go) bash

Viewed 261

I have to replace this string in dump file :

use clients_db; 

by

use client;

The name of database is different between the environment src and dest.

I tried with using sed, but it doesn't work because the file is so big.

Thank you in advance

1 Answers

This should do the job without editing your file:

sed 's/^use clients_db;/use client;/' clients_db_dump.sql | docker exec -i database mysql -uuser -ppass clients

I assume that there are no spaces before use clients_db;.

Related