I have a CSV file which has the following for example:
data1,data2,data3,data4,data5
,,,,,
data6,data7,data8,data9,data0
New lines are CRLF (`r`n) as viewed in Notepad++.
I have this in my PowerShell script to remove the line with all commas:
(Get-Content $csvPath) | Foreach-Object {$_ -replace ",,,,,`r`n", ""} | Set-Content $csvPath2
The script will not detect the returns. Even if I remove the commas and just have `r`n. However, I can replace the commas with `r`n without issues.
How can I remove that entire line of commas so that it appears as below?
data1,data2,data3,data4,data5
data6,data7,data8,data9,data0