Read first line of text file then pass following lines to a loop to read
powershell
Solution
Assign the content of the file to two variables. The first one will hold the first line, and the second variable gets the rest. Then loop over $remainingLines.
$firstLine,$remainingLines = Get-Content foo.txt
Problem
I need to read the first line of a file and then the subsequent lines I want read using a loop. eg: ``` Read in first line Do stuff with the data foreach ($line in $remainingLines) { more stuff } ``` I have a rather messy way to achieve this but there must be a better way.