I am looking for a tool or script (Textwrangler or Terminal) that can split a larger text file every 100 lines counting from line 5 (the first 4 are header lines) and output individual .txt files which include the original header.
For instance
input:
File.txt
line1 / line4 HEADER
...
line5 / line265 DATA
output:
File_01.txt
line1/line4 HEADER
line5/line104 DATA
File_02.txt
line1/line4 HEADER
line5/line104 DATA
File_03.txt
line1/line4 HEADER
line5/line65 DATA
The text file uses Windows line breaks (CR LF) in case that matters.
I am currently doing this manually so any suggestions that can make this process more efficient are very welcome.