Split text file

GroupDocs.Merger allows to split text file into several resultant text files. The default behavior is to split each line into separate file.
Here are the steps on how to split text file as described:

Split text file to several one-line files (by exact line numbers)

The following code sample demonstrates how to split text file to two one-page documents with 3rd, 6th lines from source file:

with gm.Merger("c:/sample.txt") as merger:
    output_path = "c:/output/text_{0}.{1}"
    split_options = gm.domain.options.TextSplitOptions(output_path, [3, 6])
    merger.split(split_options)

This code snippet will produce:

Text fileLine numbers
line_03
line_16

Split text file to several multi-line files 

The following code sample demonstrates how to split text file to several multi-line files starting from 3rd and ending at 6th line numbers:

with gm.Merger("c:/sample.txt") as merger:
    output_path = "c:/output/text_{0}.{1}"
    split_mode = groupdocs.merger.TextSplitMode.INTERVAL;
    split_options = gm.domain.options.TextSplitOptions(output_path, split_mode, [3, 6])
    merger.split(split_options)

This code snippet will produce:

Text fileLine numbers
text_01, 2
text_13, 4, 5
text_26