Posted By

ches on 11/27/07


database sql backup ruby

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


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

 / Published in: Ruby

Courtesy of Jesse.

  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  

You need to login to post a comment.