$f = [System.IO.File]::OpenText("10-million-combos.txt") while (! $f.EndOfStream) { $line = $f.ReadLine(); if ($line -match "123456$" ) { $counter +=1 } $counter2+=1 }