LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Retreiving data from a 60G text file? (https://www.linuxquestions.org/questions/linux-server-73/retreiving-data-from-a-60g-text-file-620013/)

blackout 02-09-2008 09:27 PM

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.

syg00 02-09-2008 10:07 PM

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 sf.net site.


All times are GMT -5. The time now is 08:09 PM.