I have a CSV file (format provided below) with delimiter set to , .
As an output, we would like to remove column 4 ( Values ) from below CSV.
We need it in WINDOWS batch script only as there is no other scripting setup allowed on server. Server has powershell as well but we are not sure how to utilize powershell commands to serve below purpose.
CSV is as below:
ID, NAME, SR, Values, Status
"1", "Raj", "123", "A,B,C,D,E", "False"
"2", "Rahul", "456", "C", "False"
We tried this but, it is not working as expected :
(Get-Content .\testCSV.csv) | Foreach-Object { $_.split()[4] -join ' ' } | Out-File .\file.txt
Expected Outcome ( removed the Values column )
ID, NAME, SR, Status
"1", "Raj", "123", "False"
"2", "Rahul", "456" , "False"