You can pass an optional second argument to TOKENIZE which is the delimiter.
On Tue, Aug 21, 2012 at 6:49 PM, Leon Town <[email protected]> wrote: > Another question: > How can I specify the delimiters to split a string? > > Thanks! > > > 2012/8/10 Leon Town <[email protected]> > >> Oh Bill, you're really genius. >> Thanks! >> >> >> 2012/8/9 Bill Graham <[email protected]> >> >>> Something like this should do it: >>> >>> A = FOREACH data GENERATE name, FLATTEN(TOKENIZE(ids)); >>> >>> >>> On Wed, Aug 8, 2012 at 11:10 PM, Babu, Prashanth < >>> [email protected] >>> > wrote: >>> >>> > Can you also post the sample input and the desired output you are >>> looking >>> > for? >>> > >>> > Thanks, >>> > Prashanth. >>> > >>> > -----Original Message----- >>> > From: Leon Town [mailto:[email protected]] >>> > Sent: Thursday, August 09, 2012 11:08 AM >>> > To: [email protected] >>> > Subject: [HELP] How to split a string in pig script ? >>> > >>> > The input schema is: >>> > *{name:chararray, ids:chararray}*, >>> > >>> > and the format of *ids* is like: >>> > id1,id2,id3,...,idn >>> > >>> > Now, I want to split *ids* and change the input into the below format: >>> > name id1 >>> > name id2 >>> > ... >>> > name idn >>> > >>> > >>> > How should I do this by pig script, instead of UDFs. >>> > >>> > Thanks! >>> > >>> > ______________________________________________________________________ >>> > Disclaimer:This email and any attachments are sent in strictest >>> confidence >>> > for the sole use of the addressee and may contain legally privileged, >>> > confidential, and proprietary data. If you are not the intended >>> recipient, >>> > please advise the sender by replying promptly to this email and then >>> delete >>> > and destroy this email and any attachments without any further use, >>> copying >>> > or forwarding >>> > >>> >>> >>> >>> -- >>> *Note that I'm no longer using my Yahoo! email address. Please email me >>> at >>> [email protected] going forward.* >>> >> >> > -- *Note that I'm no longer using my Yahoo! email address. Please email me at [email protected] going forward.*
