I am trying to split a big text files after n number of empty lines. The text file contains exactly one empty line as data separator. Like below:
Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem
Lorem
...
I have tried to use csplit
csplit data.txt /^$/ {3}
My expectation is that after 3 empty lines (not consecutive, but after cursor processes 3 empty lines) it split file and continue to do so. But it actualy splits file in each empty line.
My expected files: xx00
Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem ipsum
xx01
Lorem ipsum
Lorem ipsum
Lorem
Lorem
Any suggestion?
With
awk
(tested with GNU and BSDawk
):