Is it possbilbe to exit Select-String after 100 matches so that it does not have to read until the end of the text file?
I want to get a sample of matches that is only first 100 matches.
Is there a way to achieve this?
Is it possbilbe to exit Select-String after 100 matches so that it does not have to read until the end of the text file?
I want to get a sample of matches that is only first 100 matches.
Is there a way to achieve this?
Try this. You probably could use a Do-Until loop or a for loop and increment a counter then break the loop once you reach the desired number.
$q = Get-Content 'C:\docs\qqq.txt'
$q | Select-String -Pattern "(Patching)" | Select -first 100