I have a CSV file as below but id like column 1 and 4 removed and the last row removed and and the speech marks removed then to export a new file to a UNC path. I also want the script to run from a UNC path too if at all possible. Can the new filename be the same as the original with the addition of _new?
Current File (file.txt):
"col1","col2","col3","col4","col5" "col1","col2","col3","col4","col5" "col1","col2","col3","col4","col5" "col1","col2","col3","col4","col5" "","","","","","","","","","","","","1111.00","11",""
Expected end result (file_new.csv):
col2,col3,col5 col2,col3,col5 col2,col3,col5 col2,col3,col5
The PowerShell script I tried to use is:
Import-Csv C:\temp\*.txt -Delimiter "," |
Select Column2,Column3,Column5 |
Export-Csv C:\Temp\New.txt -Delimiter "," -Encoding UTF8 -NoTypeInfo