|
| Re: Convert CSV semi-colone to comma separated |
 |
Thu, 10 Apr 2008 04:58:54 -050 |
Gregor;678678 Wrote:
> 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
Gregor,
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.
--
Joe
_[image:
http://uswave.net/vistax64/joetmvx64.png]
(\"http://www.vistax64.com\")_
_*::Click_here_for_the_Vista_Forums::*
(\"http://www.vistax64.com/index.php?referrerid=17621\")_
_Geekbench_Score:_4050
(\"http://browse.geekbench.ca/geekbench2/view/42901\")_
_CPU-Z_Verified
(\"http://valid.x86-secret.com/show_oc.php?id=323179\")_
|
| Post Reply
|
| Re: Convert CSV semi-colone to comma separated |
 |
Thu, 10 Apr 2008 08:25:11 -060 |
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 |
| Post Reply
|
| Convert CSV semi-colone to comma separated |
 |
Thu, 10 Apr 2008 11:06:19 +020 |
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
|
| Post Reply
|
| Re: Convert CSV semi-colone to comma separated |
 |
Thu, 10 Apr 2008 12:22:29 +020 |
Hi
I would like this with PowerShell, as Service
The CSV is a extract from a other resource
Gregor
".Joe" <Joe.37nbhz@no-mx.forums.net> wrote in message
news:Joe.37nbhz@no-mx.forums.net...
>
> Gregor;678678 Wrote:
>> 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
>
> Gregor,
>
> 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.
>
>
> --
> Joe
>
> _[image:
> http://uswave.net/vistax64/joetmvx64.png]
(\"http://www.vistax64.com\")_
> _*::Click_here_for_the_Vista_Forums::*
> (\"http://www.vistax64.com/index.php?referrerid=17621\")_
> _Geekbench_Score:_4050
> (\"http://browse.geekbench.ca/geekbench2/view/42901\")_
> _CPU-Z_Verified
(\"http://valid.x86-secret.com/show_oc.php?id=323179\")_
> _**_
|
| Post Reply
|
|
|