Who can help to make this search faster? With this code the search takes a few days.
Search_Names.csv
(about 10k names)
Need_This_Long_Strings.csv
(about 180k strings and it's 50MB)
$TimeStamp = Get-Date -Format {yyyy.MM.dd_hh.mm.ss}
$SearchNames = gc D:\Search_Names.csv
$WhereSearch = gc D:\Need_This_Long_Strings.csv
$Val = 0
foreach ($SearchName in $SearchNames)
{
$WhereSearch | Where{$_ | Select-String -Pattern "$SearchName.*"} | Out-File D:\Find_in_Search_File_$TimeStamp.log -Append
$Val = $Val + 1
}
"Count of matches - $Val" |Out-File D:\Find_in_Search_File_$TimeStamp.log -Append