Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 02-09-2008, 09:27 PM   #1
LQ Newbie
Registered: Oct 2007
Posts: 4

Rep: Reputation: 0
Retreiving data from a 60G text file?

I have a large text file which is about 60gig in size. It's an SQL dump created by mysqldump.

I need to restore data from one of the tables. Restoring the whole file is not ideal.

My question is, how do I get just that segment of data out of the file?

I tried a ruby script which I found from googling around. But when I ran it, it just slowly ate up all of the memory and crashed the server.

Link to ruby script

I need to get everything between a line that says "CREATE TABLE `table_needed`" and "CREATE TABLE `next_table`

I think csplit would work, but I have no idea how to use it.

Any help appreciated.
Old 02-09-2008, 10:07 PM   #2
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 13,135

Rep: Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262
Try sed - if those lines are inclusive, it's pretty standard. Although those back-ticks might make it interesting.
Have a look at th sed onelines on the site.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
extracting data from html files into one text file adityavpratap Slackware 9 05-10-2007 10:30 AM
Bash Scripting help, altering data in text file. trey85stang Linux - General 4 05-31-2006 05:18 AM
inserting the data thru php in a text file suchi_s Programming 5 02-02-2005 03:28 AM
outputting data from a directory to a text file? minm Linux - Newbie 2 12-19-2004 06:46 PM
best method to replace data in a text file? gsbarry Linux - General 5 04-15-2003 08:21 AM

All times are GMT -5. The time now is 07:30 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration