![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest
Posts: n/a
| Convert CSV semi-colone to comma separated Hello I have a CSV File for import in AD firstname;lastname;street,description Max;Huber;Street 1;Max Huber, Street 1 >In the description, I have a commas! How convert the csv to comma separated fistname,lastname,street,description Max,Huber,Street 1,"Max Huber, Street 1" You have an idea how this makes? For converting in comma with inverted comma (apostrophe) Thanks Gregor |
|
|
| |
| | #2 (permalink) |
| 1337 spammer ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Mar 2008 Vista x86 Ultimate SP1
Posts: 806
Location: 127.0.0.1 | Re: Convert CSV semi-colone to comma separated If I understand your post correctly, you want to replace a ";" with a "," (without the quotes) in a text file. Open the file with notepad. Click on edit, click replace. Put a ; in the find what box, and put a , in the replace with box. That should make the process easier for you. |
| | |
| | |
| | #3 (permalink) | ||||||||||||||||||||||||
| Guest
Posts: n/a
| Re: Convert CSV semi-colone to comma separated Hi I would like this with PowerShell, as Service The CSV is a extract from a other resource Gregor ".Joe" <Joe.37nbhz@xxxxxx-mx.forums.net> wrote in message news:Joe.37nbhz@xxxxxx-mx.forums.net...
| ||||||||||||||||||||||||
| |||||||||||||||||||||||||
| | #4 (permalink) |
| Guest
Posts: n/a
| Re: Convert CSV semi-colone to comma separated Split each line from the original CSV file on each ';', if any of the split strings matches a ',' surrounded it with double quotes and join all split strings back with a ','. Then set the modified content to the same, or to another, CSV file. Also, if your encoding is not Unicode --PowerShell's default-- pass it to Get-Content and Set-Content statements through their -Encoding parameter. # modifying same file, using Unicode encoding $csvFile = <path to CSV file> set-content $csvFile (get-content $csvFile | % {[string]::join(',', ($_.split(';') | % {if ($_ -match ',') {"`"$_`""} else {$_}}))}) # test it import-csv $csvFile -- Kiron |
|
| |
| |