Ruby One-liner for Restoring One Table from a Huge SQL Dump

/ Published in: Ruby
Save to your folder(s)

Courtesy of Jesse.

Copy this code and paste it in your HTML
  1. ruby -ne '@found=true if $_ =~ /^CREATE TABLE `foo`/i; next unless @found; exit if $_ =~ /^CREATE TABLE (?!`foo`)/i; puts $_;' giant_sql_dump.sql > foo.sql

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.