Split after the occurence number - Issue

I have an SQL query file to split by 1000 lines but unfortunately when I choose “Split after the occurence number” there is one bug.
Here are the options that I’ve used :
I want to split after the nth occurence of a specified pattern -> Split after the occurence number -> 1000 -> 0x0D0x0A
Piece Name Mask : test_{oru}.sql
Do not add GSplit tags to piece files -> Insert additional header to pieces -> Copy all the data prior to the first occurence or line

At each files (starting from the second) one line is missing.
But when I choose “Split before the occurence number” all works perfectly (cpatternhowsplit_ItemIndex set to 1).

Big file content :
Line 0001

Line 1000
Line 1001
Line 1002

Line 2000
Line 2001

Line xxxx

File 1 is ok :
Line 0001

Line 1000

File 2 is bad :
Line 1002

Line 2001

Should be :
Line 1001

Line 2000

Also, is it possible to add an option to delete the last character or a pattern at the end of each file splited :?:
For my case, I need to remove the last “,” (comma) from the SQL command to avoid an error.
I think, it could be useful for other cases :!:

Just in case here is the file config :

<?xml version="1.0" encoding="iso-8859-1"?>
      <Item0>Bienvenue dans ce programme. Il vous permet de restaurer le fichier découpé suivant :</Item0>
      <Item2> {filename}</Item2>
      <Item3> {desc}</Item3>
      <Item4> Taille : {size} ; {fullsize} octet(s).</Item4>
      <Item5> {piececount} fichiers pièce sont requis.</Item5>
      <Item7>Choisissez où vous souhaitez placer le fichier restauré</Item7>
      <Item8>et cliquez sur Unifier pour continuer.</Item8>
    <tabout_Text>Ce fichier a été découpé avec GSplit gratuit et disponible à www.gdgsoft.com</tabout_Text>
    <tlang_Text>C:\Program Files (x86)\GSplit\Languages\English.gsl</tlang_Text>
    <GTit_Text>Archive GSplit</GTit_Text>
    <createur_Text>GSplit 3.0.1</createur_Text>

Thanks. I’ll study the problem.

Ha you just solved my problem,

I have the same, already figured out that splitting after the xxxth occurrence of 0x0D0x0A.

0x0D0x0A will not be included at the end of the first copied line.

So the first line of the parts are the copied line from part1 and the first line of part-XX.

I use it to split large csv files, no interest of joining again.

Never tried the option to split before the occurrence but just opened the parts with notepad++ and included the cr lf manualy.

For me no big deal to split before or after, however it’s an error.


I’m also encountering this problem on a project I’m working on. (no actual data missing, just that the extra inserted header line isn’t terminated properly)

Perhaps having an option to allow “include pattern” when using the “copy all the data prior to the first occurrence or line” will allow it to work for us, without breaking existing behaviour for any use case where it is desirable.