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.

extract certain string value from log

Highlighted

extract certain string value from log

New Contributor

i'm having a problem when parsing string from log file, this is the case:

"skey":"110","scp_id":"OC05","capedge":"3G","ResultDesc":"Operation is successful","card_type":"USIM","ResultCode":"0"
"skey":"140","scp_id":"OC02","capedge":"3G","ResultDesc":"Operation is successful","card_type":"SIM","ResultCode":"0"
"skey":"0","scp_id":"OC01","capedge":"3G","ResultDesc":"Operation failed","card_type":"USIM","ResultCode":"1"

this is our expected output for our table

|   skey    |   scp_id  |   capedge |
|   110     |   OC05    |   3G      |
|   140     |   OC02    |   3G      |
|   0       |   OC01    |   3G      |

i've tried using parse_url method from https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF but unfortunately our string is not in url format, is there any better approach for this? or do i have to use regexp_extract for this?

 

thank you,

Galih

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