using Python, I am trying to split up a .txt file with over 50,000 lines into many smaller new .txt files after each instance of 1 or more empty lines in the original file. Each chunk of text in the original file may contain a variable number of lines of characters before the next series of 1 or more empty lines.
Example of file contents:
‘first file contents
first file contents
first file contents
second file contents
second file contents
third file contents
third file contents
fourth file contents’
For the above, the desired output of files would be:
file1.txt:
first file contents
first file contents
first file contents
file2.txt:
second file contents
second file contents
file3.txt:
third file contents
third file contents
file4.txt:
fourth file contents
I reviewed several other question/answers but did not find any that meet what I am looking for.
Split a large text file into multiple files using delimiters
Split file after X lines at blank line