$File="C:\temp\test\ID.txt"
$line="ART.023.AGA_203.PL"
Measure-Command {$Sel = Select-String -pattern $line -path $File }
Measure-Command {
$reader = New-Object System.IO.StreamReader($File)
$content = $reader.ReadToEnd().Split('`n')
$results = $content | select-string -Pattern $line
}
Measure-Command {
$content= get-content $File
$results = $content | select-string -Pattern $line
$results
}
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 197
Ticks : 1970580
TotalDays : 2.28076388888889E-06
TotalHours : 5.47383333333333E-05
TotalMinutes : 0.0032843
TotalSeconds : 0.197058
TotalMilliseconds : 197.058
Days : 0
Hours : 0
Minutes : 0
Seconds : 4
Milliseconds : 135
Ticks : 41350664
TotalDays : 4.78595648148148E-05
TotalHours : 0.00114862955555556
TotalMinutes : 0.0689177733333333
TotalSeconds : 4.1350664
TotalMilliseconds : 4135.0664
Days : 0
Hours : 0
Minutes : 0
Seconds : 4
Milliseconds : 926
Ticks : 49265692
TotalDays : 5.70204768518518E-05
TotalHours : 0.00136849144444444
TotalMinutes : 0.0821094866666667
TotalSeconds : 4.9265692
TotalMilliseconds : 4926.5692
i want to search about 10000 $line in $File
search time very slower,any faster?
example :
search Keyword:$line ,then $File will show line
Keyword:ART.023.AGA_203.PL
file:2,45433;ART.023.AGA_203.PL;dddd;wwww;tt;