title: How do I check a string exist in a file using PowerShell?
body: <p>I have a 1st text file looks like this : 12AB34.US. The second text file is CD 34 EF.
  I want to find my 2nd text file exist or not in the 1st text file.</p>
  
  <p>I tried to cut 3 characters last in the first text file (.US). Then I split to each 2 characters (because the 2nd text file consist of 2 characters). Then, I tried this code, and it always return "Not Found".</p>
  
  <pre><code>$String = Get-Content "C:\Users\te2.txt"
  $Data = Get-Content "C:\Users\Fixed.txt"
  $Split = $Data -split '(..)'
  
  $Cut = $String.Substring(0,6)
  
  $String_Split = $Cut -split '(..)'
  $String_Split
  
  $Check= $String_Split | %{$_ -match $Split}
  if ($Check-contains $true) {
      Write-Host "0"
  } else {
       Write-Host "1"
  }
  </code></pre>