title: Do line endings differ between Windows and Linux?
body: <p>I am trying to parse the Linux <code>/etc/passwd</code> file in Java.  I'm currently reading each line through the <a href="https://docs.oracle.com/javase/9/docs/api/java/util/Scanner.html" rel="noreferrer"><code>java.util.Scanner</code></a> class and then using <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/String.html#split-java.lang.String-" rel="noreferrer"><code>java.lang.String.split(String)</code></a> to delimit each line.</p>
  <p>The problem is that the line:</p>
  <pre><code>list:x:38:38:Mailing List Manager:/var/list:/bin/sh&quot; 
  </code></pre>
  <p>is treated by the scanner as 3 different lines:</p>
  <ol>
  <li><code>list:x:38:38:Mailing</code></li>
  <li><code>List</code></li>
  <li><code>Manager...</code></li>
  </ol>
  <p>When I type this out into a new file that I didn't get from Linux, <code>Scanner</code> parses it properly.</p>
  <p>Is there something I'm not understanding about new lines in Linux?</p>
  <p>Obviously a work around is to parse it without using scanner, but it wouldn't be elegant.  Does anyone know of an elegant way to do it?</p>
  <p>Is there a way to convert the file into one that would work with <code>Scanner</code>?</p>
  <hr />
  <p>Not even two days ago: <a href="https://stackoverflow.com/questions/419291/historical-reason-behind-different-line-ending-at-different-platforms">Historical reason behind different line ending at different platforms</a></p>
  <p><strong>EDIT</strong></p>
  <p>Note from the original author:</p>
  <blockquote>
  <p><em>&quot;I figured out I have a different error that is causing the problem. Disregard question&quot;</em></p>
  </blockquote>