I\'m working with a big text file, I mean more than 100 MB big, and I need to loop through a specific number of lines, a kind of subset so I\'m trying with this,
<
PS> help select -param index
-Index
Selects objects from an array based on their index values. Enter the indexes in a comma-separated list.
Indexes in an array begin with 0, where 0 represents the first value and (n-1) represents the last value.
Required? false
Position? named
Default value None
Accept pipeline input? false
Accept wildcard characters? false
Based on the above, '8,13' will get you just two lines. One thing you can do is pass an array of numbers, you can use the range operator:
Get-Content -Path $TextFile | Select-Object -Index (8..13) | Foreach-Object {...}