For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > April 2005 > Newbie Help









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Newbie Help
shirazk@gmail.com

2005-04-27, 3:57 am

I want to know if there is a way to do this is perl
A sample of the data is:

field1,field2,"3232,34,56",field4,field5

and i need to convert it into three individual records:

field1,field2,3232,field4,field5
field1,field2,34,field4,field5
field1,field2,56,field4,field5

The field in quotes might contain many more or less entries, even at
times none.
Any help is greatly appreciated.
Thanks a lot.

Gunnar Hjalmarsson

2005-04-27, 3:57 am

shirazk@gmail.com wrote:
> I want to know if there is a way to do this is perl
> A sample of the data is:
>
> field1,field2,"3232,34,56",field4,field5
>
> and i need to convert it into three individual records:
>
> field1,field2,3232,field4,field5
> field1,field2,34,field4,field5
> field1,field2,56,field4,field5
>
> The field in quotes might contain many more or less entries, even at
> times none.
> Any help is greatly appreciated.


Yes, there are ways to do it in Perl.

You forgot to post the code you have so far; Without it it's hard to
help you. Please study the posting guidelines for this group:
http://mail.augustmail.com/~tadmc/c...guidelines.html
before posting the code.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
shirazk@gmail.com

2005-04-27, 3:57 am

I havent done any perl.. i am just starting... now that i know it is
doable, i will try to get some parsing code and post it in a day or
two.. can you tell me a particular command i should use some hint?
thanks for the fast reply and input

Rodney Rindels

2005-04-27, 3:57 am

shirazk@gmail.com wrote:
> I havent done any perl.. i am just starting... now that i know it is
> doable, i will try to get some parsing code and post it in a day or
> two.. can you tell me a particular command i should use some hint?
> thanks for the fast reply and input
>

You should probably start with the perlfaq's to get a general
understanding.

http://perldoc.perl.org

is a good place to start.

there are actually many ways to build your parser in perl. I would
suggest your start with understanding perls data types first.

http://perldoc.perl.org/perlfaq4.html

Welcome to one of the most exciting languages on Earth.

Rod
David H. Adler

2005-04-27, 3:58 pm

On 2005-04-27, Rodney Rindels <rrindels@spinn.net> wrote:
> shirazk@gmail.com wrote:
> You should probably start with the perlfaq's to get a general
> understanding.
>
> http://perldoc.perl.org


http://learn.perl.org is probably another good starting point.

dha

--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Free Randal Schwartz! <http://www.rahul.net/jeffrey/ovs/>
(ok, maybe not free, but competitively priced!)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com