Convert Mysql Dump File from INSERT to INSERT IGNORE

I have a huge dump file about 40G in size, and I need to send it back to the database, because after the restoration some records are missing. Is there an easy way I can hide INSERT in INSERT IGNORE in a dump file to avoid duplicate entries? loading a file into a text editor seems impossible to me. thank you very much in advance

+7
source share
3 answers

If you are using a UNIX-like operating system, you can use sed :

 cat file.sql | sed s/"^INSERT"/"INSERT IGNORE"/g > updated.sql 
+9
source

There is also a switch for mysqldump

- insert-ignore in mysqldump

+15
source

Use a text application, such as sed , from the command line to replace the import search.

+1
source

All Articles