joec_ has asked for the wisdom of the Perl Monks concerning the following question:
I have a CSV in which i need to replace the delimiters. I need to change from comma to pipe (|). I know it shouldnt be challenging but i cant seem to twig it. The header fields should be changed to pipe seperated as well.
I have tried:
So essentially substitute all commas for pipes except quoted strings. I know its something like this, but cant quite get it ...while ($line = <INPUT>){ $line =~ s/,/|/g unless ($line =~ /,\"(.*),(.*)\",/); }
The upshot of this is that each line (as a pipe separated string) is going to get inserted into Oracle as a CLOB.
Any help appreciated
Thanks -- Joe
-----
Eschew obfuscation, espouse elucidation!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Replacing commas with pipes
by almut (Canon) on May 11, 2009 at 19:11 UTC | |
|
Re: Replacing commas with pipes
by toolic (Bishop) on May 11, 2009 at 19:21 UTC | |
by JavaFan (Canon) on May 11, 2009 at 19:32 UTC | |
by ww (Archbishop) on May 11, 2009 at 19:48 UTC | |
|
Re: Replacing commas with pipes
by JavaFan (Canon) on May 11, 2009 at 19:16 UTC |