title: Split large text file using keyword delimiter
body: <p>I'm trying to split a large text files into smaller text files by using a word delimiter. I tried searching but I've only seen posts to break apart files after x lines. I'm fairly new to programming but I've given it a start. I want to go through all the lines, and if it starts with hello, it will put all of those lines into one file until it reaches the next hello. The first word in the file is hello. Ultimately, I'm trying to get the text into R, but I think it would be easier if I split it up like this first. Any help is appreciated, thanks.</p>
  
  <pre><code>text_file = open("myfile.txt","r")
  lines = text_file.readlines()
  print len(lines)
  for line in lines :
      print line
      if line[0:5] == "hello":
  </code></pre>