SimonS
SimonS

Reputation: 1973

Import-CSV separated by ; instead of , PowerShell

I'm using a CSV to store some information which I want to use in Powershell. To make the CSV more "readeable" I decided to put every piece of information into a separate field. If I use import-csv in powershell, the return is like this:

Test1;Test2;Test3
-----------------
Val1;Val2;Val3

PowerShell can't handle the ; - so I was asking myself if there is any way to import the CSV as it is now, but replace every ";" with a "," so PowerShell will use it as

Test1  Test2  Test3
-----  -----  -----
Val1   Val2   Val3

I tried it like this

$test = (import-csv test.csv).Replace(";",",")

but it doesn't work

Does anyone have a solution? Thank you in advance!

Upvotes: 0

Views: 539

Answers (1)

alroc
alroc

Reputation: 28204

Import-CSV can handle the ; delimiter just fine - use the -delimiter ';' -parameter.

Upvotes: 4

Related Questions