restrict select-string to certain columns of a text file

I am working with very large text files, consisting of very log lines (> 1000 characters per line). Using select-string to find a 10-character string in these files takes a couple of minutes. I am trying to find ways to optimize the search.Is there a way that I could restrict the search to certain characters of each line in the text file. For example, I might know that the string I am searching for is in position 350 to 352. Thanks for any assistance.

Working with large text files means, do not use Get-Content.

Why Get-Content Ain't Yer Friend ''

Use the .Net file libraries.


How are you using Select-String?

Have you looked at the speed difference between Select-String and plain RegEx match?

I’m not sure if this is faster but:

get-content text | foreach { $_.substring(349,361) } | select-string whatever10

Have you tried get-content’s -readcount parameter?