Last active
November 2, 2015 19:28
-
-
Save steffenr/fd67611026ef022a02cb to your computer and use it in GitHub Desktop.
Extract single table from mysql dump
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extract CREATE / INSERT from default mysql dump. | |
zcat > dump.sql.gz | sed -n -e '/CREATE TABLE.*`my_table`/,/UNLOCK TABLES/p' > my_table.sql | |
# Extract INSERTs only. | |
zcat > dump.sql.gz | sed -n -e '/INSERT INTO `my_table`/,/UNLOCK TABLES/p' > my_table.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you get the error sed: RE error: illegal byte sequence, you should set the following parameters in your ~/.bash_profile or ~/.zshrc.