Skip to content

Instantly share code, notes, and snippets.

@songlipeng2003
Created January 14, 2014 13:32
Show Gist options
  • Save songlipeng2003/8418363 to your computer and use it in GitHub Desktop.
Save songlipeng2003/8418363 to your computer and use it in GitHub Desktop.
Extracting a table or a database from a mysql.sql dump file
# extract table
sed -n -e '/CREATE TABLE.*mytable/,/CREATE TABLE/p' mysql.sql > mytable.sql
# extract database
sed -n -e '/Current Database: `mydatabase`/,/Current Database: /p' mysql.sql > mydatabase.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment