title: Scala: how to extract a data from text file with the specified start and end keywords in scala
body: <p>I am writing below code however I am not able to get how to extract the data from given start and end position after getting the specified extracted data I would like to write the same extracted data into new file, please help me on this.</p>
  
  <pre><code>val f = scala.io.Source.fromFile("file.txt")
  
    for (line &lt;- f.getLines())
  
      f.close()
  </code></pre>