I have a CSV who’s size is measured in Gigabytes. I need to read it in but skip the first line, since the first line doesn’t actually contain the headers.
I can use Get-Content -First 1 to get the first line of the file, but is there a way to do the opposite? Or, is there a way to simply remove the first line of the file?
I’m aware I can simply Import-CSV and pipe it to Select-Object -skip 1 but that takes way too long for a huge file. If there is a way to do it using Get-Content, I’d still have to pipe it to ConvertFrom-CSV which would also take way too long.
What’s the fastest way to accomplish this?
For some background: The program doesn’t know whether or not the file it is given will have headers in the first line or not. I have logic that finds the row that has the headers. Now I just need to be able to read the file, starting at the row with the headers, in a way that doesn’t eat up my 16GB of RAM.