Search code examples
insertmysql

Convert Mysql Dump File from INSERT to INSERT IGNORE


I have a huge dump file about 40G in size, and I need to dump that back into the database since there are some records are missing after a recovery. Is there any easy way I can covert the INSERT into INSERT IGNORE in the dump file to avoid duplicate entries errors? loading the file to a text editor seems a no go to me. thank you very much in advance


Solution

  • If your using a unix-like operating system, you can use sed:

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