Monday, July 11, 2011

Extract single table from gzipped mysqldump file.

# with drop and create statements
$ zcat event_tables_prod1.sql.gz | sed -n "/^-- Table structure for table \`WEEKLY_EXCEPTION_REPORT\`/,/^-- Table structure for table/p" >
# without drop and create statements
$ zcat event_tables_prod1.sql.gz | sed -n "/^-- Dumping data for table \`WEEKLY_EXCEPTION_REPORT\`/,/^-- Dumping data for table /p" > exceptions_only_prod1.sql

No comments: