Skip to content

Instantly share code, notes, and snippets.

@frozenminds
Created August 19, 2014 18:18
Show Gist options
  • Save frozenminds/669efb52451459aa529e to your computer and use it in GitHub Desktop.
Save frozenminds/669efb52451459aa529e to your computer and use it in GitHub Desktop.
Strip "INSERT INTO `table`" junk out of Magento SQL dumpfile. Use it when dump is huge and you can not even import it.
cat dump.sql | grep -v "INSERT INTO \`catalog_compare_item\`" | grep -v "INSERT INTO \`wishlist_item_option\`" | grep -v "INSERT INTO \`wishlist_item\`" | grep -v "INSERT INTO \`wishlist\`" | grep -v "INSERT INTO \`adminnotification_inbox\`" | grep -v "INSERT INTO \`dataflow_batch_export\`" | grep -v "INSERT INTO \`dataflow_batch_import\`" | grep -v "INSERT INTO \`report_event\`" | grep -v "INSERT INTO \`report_viewed_product_index\`" | grep -v "INSERT INTO \`report_compared_product_index\`" | grep -v "INSERT INTO \`catalogsearch_fulltext\`" | grep -v "INSERT INTO \`catalogsearch_query\`" | grep -v "INSERT INTO \`catalogsearch_recommendations\`" | grep -v "INSERT INTO \`catalogsearch_result\`" | grep -v "INSERT INTO \`catalog_category_flat_store_1\`" | grep -v "INSERT INTO \`catalog_category_flat_store_2\`" | grep -v "INSERT INTO \`catalog_product_flat_1\`" | grep -v "INSERT INTO \`catalog_product_flat_2\`" | grep -v "INSERT INTO \`log_customer\`" | grep -v "INSERT INTO \`log_quote\`" | grep -v "INSERT INTO \`log_summary\`" | grep -v "INSERT INTO \`log_summary_type\`" | grep -v "INSERT INTO \`log_url\`" | grep -v "INSERT INTO \`log_url_info\`" | grep -v "INSERT INTO \`log_visitor\`" | grep -v "INSERT INTO \`log_visitor_info\`" | grep -v "INSERT INTO \`log_visitor_online\`" | grep -v "INSERT INTO \`core_session\`" | grep -v "INSERT INTO \`api_session\`" | grep -v "INSERT INTO \`core_cache\`" | grep -v "INSERT INTO \`core_cache_option\`" | grep -v "INSERT INTO \`core_cache_tag\`" | grep -v "INSERT INTO \`index_event\`" | grep -v "INSERT INTO \`index_process_event\`" | grep -v "INSERT INTO \`captcha_log\`" | grep -v "INSERT INTO \`sendfriend_log\`" | grep -v "INSERT INTO \`catalog_category_anc_categs_index_tmp\`" | grep -v "INSERT INTO \`catalog_category_anc_products_index_tmp\`" | grep -v "INSERT INTO \`catalog_category_product_index_enbl_tmp\`" | grep -v "INSERT INTO \`catalog_product_index_eav_decimal_tmp\`" | grep -v "INSERT INTO \`catalog_product_index_eav_tmp\`" | grep -v "INSERT INTO \`catalog_product_index_price_bundle_opt_tmp\`" | grep -v "INSERT INTO \`catalog_product_index_price_bundle_sel_tmp\`" | grep -v "INSERT INTO \`catalog_product_index_price_bundle_tmp\`" | grep -v "INSERT INTO \`catalog_product_index_price_cfg_opt_agr_tmp\`" | grep -v "INSERT INTO \`catalog_product_index_price_cfg_opt_tmp\`" | grep -v "INSERT INTO \`catalog_product_index_price_downlod_tmp\`" | grep -v "INSERT INTO \`catalog_product_index_price_final_tmp\`" | grep -v "INSERT INTO \`catalog_product_index_price_opt_agr_tmp\`" | grep -v "INSERT INTO \`catalog_product_index_price_opt_tmp\`" | grep -v "INSERT INTO \`catalog_product_index_price_tmp\`" | grep -v "INSERT INTO \`cataloginventory_stock_status_tmp\`" | grep -v "INSERT INTO \`catalog_category_anc_categs_index_idx\`" | grep -v "INSERT INTO \`catalog_category_anc_products_index_idx\`" | grep -v "INSERT INTO \`catalog_category_product_index_enbl_idx\`" | grep -v "INSERT INTO \`catalog_category_product_index_idx\`" | grep -v "INSERT INTO \`catalog_product_index_eav_decimal_idx\`" | grep -v "INSERT INTO \`catalog_product_index_eav_idx\`" | grep -v "INSERT INTO \`catalog_product_index_price_bundle_idx\`" | grep -v "INSERT INTO \`catalog_product_index_price_bundle_opt_idx\`" | grep -v "INSERT INTO \`catalog_product_index_price_bundle_sel_idx\`" | grep -v "INSERT INTO \`catalog_product_index_price_cfg_opt_agr_idx\`" | grep -v "INSERT INTO \`catalog_product_index_price_cfg_opt_idx\`" | grep -v "INSERT INTO \`catalog_product_index_price_downlod_idx\`" | grep -v "INSERT INTO \`catalog_product_index_price_final_idx\`" | grep -v "INSERT INTO \`catalog_product_index_price_idx\`" | grep -v "INSERT INTO \`catalog_product_index_price_opt_agr_idx\`" | grep -v "INSERT INTO \`catalog_product_index_price_opt_idx\`" | grep -v "INSERT INTO \`cataloginventory_stock_status_idx\`" | grep -v "INSERT INTO \`enterprise_logging_event\`" | grep -v "INSERT INTO \`enterprise_logging_event_changes\`" | grep -v "INSERT INTO \`enterprise_url_rewrite_redirect_cl\`" | grep -v "INSERT INTO \`cataloginventory_stock_status_cl\`" | grep -v "INSERT INTO \`catalogsearch_fulltext_cl\`" | grep -v "INSERT INTO \`enterprise_url_rewrite_category_cl\`" | grep -v "INSERT INTO \`enterprise_url_rewrite_product_cl\`" | grep -v "INSERT INTO \`catalog_category_product_index_cl\`" | grep -v "INSERT INTO \`catalog_category_product_cat_cl\`" | grep -v "INSERT INTO \`catalog_product_index_price_cl\`" | grep -v "INSERT INTO \`catalog_category_flat_cl\`" | grep -v "INSERT INTO \`catalog_product_flat_cl\`" > dump_stripped.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment