This can all be done, somewhat tediously, in Python using the csv library. Read through each line. If it contains only the date, start a new file. If it contains data, write the line to the new file.
I'm curious, if you have the code and can do this in Fortran, why bother making your own script?