[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 629
  • Last Modified:

How to split a big SQL dump on CREATE DATABASE

Using *nix scripts, how can I split up a big SQL dump at the point of CREATE DATABASE

i.e.

CREATE DATABASE `db1` ....
...
..
CREATE DATABASE `db2' ...
...
..
CREATE DATABASE `'db3' ...
...
..

into multiple files (ideally using the database name as the file name.

0
brothertom
Asked:
brothertom
1 Solution
 
ollfriedCommented:
Try csplit:


csplit <file>.sql '/^CREATE DATABASE/' {*}

Open in new window

0
 
brothertomAuthor Commented:
Thanks ollfried, worked a treat.   Many thanks again.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now