This one time, at band camp, Rob Sharp wrote: >I'm thinking I somehow need to split this file into manageable chunks to >import it, but the script I coded in PHP can't handle files of that size. > >Anyone have any pointers on how I can split the file based on the string >'CREATE TABLE' or something like that? A file per table would be fine to >import.
To get the line numbers of the CREATE lines: zgrep -n '^CREATE DATABASE' dump.sql.gz Split at the line numbers: zcat dump.sql.gz | sed -n 'LINE1,LINE2p' > somewhere Theres probably some better magic you can do with csplit. -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
