You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Muni mahesh <ma...@gmail.com> on 2013/09/26 14:36:03 UTC

Need to parse the data from [ ]

*Input Data :*

([37.77916,-122.42005,2496043,"A Poor Recipe For Civic Cohesion","Western
Addiction",0.48169413,1854.5113390616634],)
([41.88415,-87.63241,8522644,"Take Time","Chaka Khan_
Rufus",0.25427926,1854.5113390616634],)

*Expected Output :*

(37.77916,-122.42005,2496043,"A Poor Recipe For Civic Cohesion","Western
Addiction",0.48169413,1854.5113390616634)

(41.88415,-87.63241,8522644,"Take Time","Chaka Khan_
Rufus",0.25427926,1854.5113390616634)

*I tried like :*

extract =  foreach Displayed generate
REGEX_EXTRACT_ALL([.*,.*,.*,.*,.*,.*]);

using flatten, regex

Re: Need to parse the data from [ ]

Posted by Ruslan Al-Fakikh <me...@gmail.com>.
I suppose you need to use the RegExp groups for that, something like
([(.*),(.*)...]), and I think you need to escape []
Basically this is not a Pig problem, I would test the RegExp in Java first.

Ruslan


On Thu, Sep 26, 2013 at 4:36 PM, Muni mahesh <ma...@gmail.com>wrote:

> *Input Data :*
>
> ([37.77916,-122.42005,2496043,"A Poor Recipe For Civic Cohesion","Western
> Addiction",0.48169413,1854.5113390616634],)
> ([41.88415,-87.63241,8522644,"Take Time","Chaka Khan_
> Rufus",0.25427926,1854.5113390616634],)
>
> *Expected Output :*
>
> (37.77916,-122.42005,2496043,"A Poor Recipe For Civic Cohesion","Western
> Addiction",0.48169413,1854.5113390616634)
>
> (41.88415,-87.63241,8522644,"Take Time","Chaka Khan_
> Rufus",0.25427926,1854.5113390616634)
>
> *I tried like :*
>
> extract =  foreach Displayed generate
> REGEX_EXTRACT_ALL([.*,.*,.*,.*,.*,.*]);
>
> using flatten, regex
>