I have a tab separated text file after executing some command in powershell i want to convert this tab separated file into csv now how can i do so?
1 Answer
A tab separated text file could be treated as a CSV file with a tab instead of comma as its delimiter. To convert:
import-csv tabdelimitedfile.txt -delimiter "`t" | export-csv csvfile.csv
2 Comments
Phoenix14830
Adding -NoType to the end of that line will get rid of the "#TYPE System.Management.Automation.PSCustomObject" line at the top of the output file.
Pasan Eeriyagama
This seems to add double quotes, is there a way to omit double quotes?
while ($true) {sleep 5; ps iexplore | select Handles, NPM, PM, WS, VM, CPU, Id, Name, @{N="SampleDateTime";E={(get-date)}} | export-csv -Append -NoTypeInformation process.csv}