title: Powershell: How to I test if a line of text contains line feed or carriage return?
body: <p>How do I test if the first line of a text file is terminated with \r or \n?</p>
  
  <p>I tried various renditions similar to the following.  I'm not sure that the string imported into powershell (first line of the file) even contains the invisible characters.  I also tried using the StreamReader method to read the line to no avail.</p>
  
  <pre><code>$master = Get-Content $masterFilename | Select-Object -First 1
  if ($master.Contains("\r|\n"))
      {
          write-host "you betcha, there's a carriage return or line feed"
      }
  </code></pre>
  
  <p>Thank you.</p>