1

I am trying to split a 4GB SQL file into smaller files so that I can import them one by one to reduce errors.

Each INSERT statement starts on a new line and is preceded by );

I have tried using split -p \0\;INSERT but this does not work.

I have read about csplit however I am still unssure as to what RegularExpression is needed.

There are 117 tables across the 4GB of data.

A sample INSERT statement is as follows:

INSERT INTO 'puid' VALUES (2196534,'ee1d9e3f-b3ae-e36b-cfea-2499a18bd86e',163);
INSERT INTO 'puid' VALUES (2196535,'e2c05e1c-73bd-cdc7-0bab-610b6afe4bd7',163);
Marcelo Cantos
  • 181,030
  • 38
  • 327
  • 365
Michael
  • 4,282
  • 9
  • 55
  • 89

1 Answers1

1

Have you tried using split -l <line_count>? That'll split on line boundaries.

Marcelo Cantos
  • 181,030
  • 38
  • 327
  • 365