Mysql – extract data from large .sql dumps

Today i was handed a .sql file that was over 50GB’s, all i needed was the customer data tables – a small proportion of this data.

The following will dump the CREATE TABLE statements for all Magento customer tables aswell-as the INSERT statements.

zgrep ^"INSERT INTO `customer" db-dump.sql.gz > customer_insert.sql

zgrep -A 15 ^"CREATE TABLE `customer" db-dump.sql.gz | sed 's,-- `customer,;,g' > customer_createtables.sql


Buy Me A Coffee
back arrowBack to Index