Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How To Search A Number/String In Multiple Delimited File In Pig

Highlighted

How To Search A Number/String In Multiple Delimited File In Pig

New Contributor

Please suggest sample query in Pig for filtering 123456 from below log file.

Sample Log

2016-01-02 00:00:00#REQUEST::DLR REQUEST HANDLER::#{number=123456, operator=xyz}
2 REPLIES 2
Highlighted

Re: How To Search A Number/String In Multiple Delimited File In Pig

Expert Contributor

You can use pig udf

Re: How To Search A Number/String In Multiple Delimited File In Pig

Is the format always the same? If yes, how about something like this=>

data = LOAD 'out.log' using PigStorage('#');
res = foreach data generate REGEX_EXTRACT($2, '\\d+',0);
dump res;

Result:

(123456)
Don't have an account?
Coming from Hortonworks? Activate your account here