title: How to grab text with newlines in a text file?
body: <p>I have a text file with the below content:</p>
  
  <blockquote>
    <p>.....</p>
    
    <p>Phone:     123-456-7899, 555-555-5555, 999-333-7890</p>
    
    <p>Names:     Bob Jones, Mary Smith, Bob McAlly,</p>
    
    <p>Sally Fields, Tom Hanks, Jeffery Cook, </p>
    
    <p>Betty White, Tom McDonald, Bruce Harris</p>
    
    <p>Address:  1234 Main, 445 Westlake, 3332 Front Street<br>
     .....</p>
  </blockquote>
  
  <p>I am looking to grab all of the names starting from Bob Jones and ending with Bruce Harris from the file.  I have this Scala code, but it only gets the first line:</p>
  
  <blockquote>
    <p>Bob Jones, Mary Smith, Bob McAlly,</p>
  </blockquote>
  
  <p>Here is the code:</p>
  
  <pre><code>val addressBookRDD = sc.textFile(file);
  val myRDD = addressBookRDD.filter(line =&gt; line.contains("Names: ")
  </code></pre>
  
  <p>I don’t know how to deal with the returns or newlines in the text file, so the code only grabs the first line of the names, but not the rest of the names which are separate lines. I am looking for this type of result:</p>
  
  <blockquote>
    <p>Bob Jones, Mary Smith, Bob McAlley, Sally Fields, Tom Hanks, Jeffery
    Cook, Betty White, Tom McDonald, Bruce Harris</p>
  </blockquote>