I want to replace the ;
in data to :
in HIVE
tried the following but not working
hive> select REGEXP_REPLACE('Mozilla/5.0 (Macintosh; Intel',';',':');
How to achieve this in HIVE. I am getting issues while transforming this.
I want to replace the ;
in data to :
in HIVE
tried the following but not working
hive> select REGEXP_REPLACE('Mozilla/5.0 (Macintosh; Intel',';',':');
How to achieve this in HIVE. I am getting issues while transforming this.
Just use replace()
:
select replace('Mozilla/5.0 (Macintosh; Intel', ';', ':')
replace()
is described in the documentation.
You need to escape the semicolon. Please see below
hive> select REGEXP_REPLACE("Mozilla/5.0 (Macintosh\; Intel","\;",":");
OK
Mozilla/5.0 (Macintosh: Intel
Time taken: 0.082 seconds, Fetched: 1 row(s)
U may try this
method 1: REGEXP_REPLACE('Mozilla/5.0 (Macintosh; Intel','\;',':');
method 2: REGEXP_REPLACE('Mozilla/5.0 (Macintosh; Intel','\\;',':');