删除字符串中间的字符

wmomyfyw  于 2021-06-26  发布在  Hive
关注(0)|答案(1)|浏览(410)

我的列有以下数据:(这是一个示例,实际列有100万行)
输入:

NumberID
17.843.983-9
8.365.938-1
10.294.487-5

我需要从字符串中删除两个“.”。预期列:
预期产量:

NumberID
17843983-9
8365938-1
10294487-5

我尝试了substr和regexp替换,但似乎找不到正确的方法。

p5fdfcr1

p5fdfcr11#

hive> with t as (select stack(3,'17.843.983-9','8.365.938-1','10.294.487-5') as col)
    > select  regexp_replace(col,'\\.','')
    > from    t
    > ;
OK
_c0
17843983-9
8365938-1
10294487-5

hive> with t as (select stack(3,'17.843.983-9','8.365.938-1','10.294.487-5') as col)
    > select  replace(col,'.','')
    > from    t
    > ;
OK
_c0
17843983-9
8365938-1
10294487-5

相关问题