Remove double quotes from Export-CSV commandlet (or files with double quotes


When use default Export-CSV commandlet, the csv file are double quoted.
The following script can remove them all.



$file="C:\temp\filefinal.csv"
(Get-Content $file) | Foreach-Object {$_ -replace '"', ''}|Out-File $file

##Open in notepad
notepad $file



Or this version:
$file="C:\temp\filefinal.csv"
(GC $file) | % {$_ -replace '"', ''}  > $file

##Open in notepad
notepad $file

 
Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s