0

I have a file having data like below in pig

<"{\"action\": \"ac_data\",\"data\":{\"nn1\":\"0000000\",\"zerosquare\":\"newuser\",\"nacde\":\"catlogue\",\"user123\":\"99000200340904\",\"lcadq\":\"89148000001972298094\",\"reserve\":\

And I want to remove \ and the output should be as below

<"{"action": "ac_data","data":{"nn1":"0000000","zerosquare":"newuser","nacde":"catlogue","user123":"99000200340904","lcadq":"89148000001972298094","reserve":
halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

Input :

<"{\"action\": \"ac_data\",\"data\":{\"nn1\":\"0000000\",\"zerosquare\":\"newuser\",\"nacde\":\"catlogue\",\"user123\":\"99000200340904\",\"lcadq\":\"89148000001972298094\",\"reserve\":\

Pig Script :

A = LOAD 'input.csv' as line;  
B = FOREACH A GENERATE REPLACE(line,'([\\\\]+)','');  
dump B;  

Output :

(<"{"action": "ac_data","data":{"nn1":"0000000","zerosquare":"newuser","nacde":"catlogue","user123":"99000200340904","lcadq":"89148000001972298094","reserve":)

Ref :

Can't escape the backslash with regex?

Community
  • 1
  • 1
Murali Rao
  • 2,287
  • 11
  • 18