Search code examples
sublimetext3text-parsing

Sublime add text per 5000 lines


I have large .sql file with (multiple inserts).

I want using sublime 3 to add per 5000 lines , one command like :

commit;

Is it possible ? Thanks ijn advance


Solution

  • Using regex you can capture a line using : (.+\s) .
    Then add a quatifier to determine the number of lines you want to capture: {5000}
    And replace the Group of N lines by : "[Group of N lines][My new Text][newLine]"
    It give you : `$0newData\n

    Here is an exemple on a simple text file, with "newData" every 3 lines. And an online exemple. enter image description here

    Nb: Click the .*, to activate the "Use regex in find search" option.