how to write them in separate text files
I have a text file having the following content:
......
end
............
...........
...................
end
............................
.........
end
What I'm trying to do is to divide the content of the file into several pieces just by the keyword "end", and then write each piece into a separate text file. Could anybody teach me how to implement this. Thank you very much!

