Reply
New Contributor
Posts: 4
Registered: ‎04-11-2017

extract certain string value from log

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

Announcements