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,
$info = Get-Content -Path $TextFile | Select-Object -Index $from,$to
foreach ($line in $info)
{
,,,
But it does not work. It is like if it only gets the first line in the subset.
I don’t find documentation about the Index attribute, so is this possible or should I try using a different approach considering the file size?
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: