2017-08-30 54 views
0

我列具有下列数据:(这是一个例子,真正的人有一个百万行)删除字符中旬STRING

输入:

NumberID 
17.843.983-9 
8.365.938-1 
10.294.487-5 

我需要同时删除”。 “来自字符串。预计柱:

期望输出:

NumberID 
17843983-9 
8365938-1 
10294487-5 

我试着用SUBSTR和正则表达式替换,但我似乎无法找到正确的道路。

回答

0
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