参考地址:http://blog.sina.com.cn/s/blog_b3eabfd30102wldv.html 参考语句: if object_id('[aaa]') is not null drop table [aaa] go create table [aaa]([地区] varchar(4),[内容] varchar(45)) insert [aaa] select '中国','021sp.html|管材|4355;028sp.html|建筑材料|3209' union all se
Hive建表的时候虽然可以指定字段分隔符,不过用insert overwrite local directory这种方式导出文件时,字段的分割符会被默认置为\001,一般都需要将字段分隔符转换为其它字符, 可以使用下面的命令:sed -e 's/\x01/|/g' file 可以将|替换成自己需要的分隔符,file为hive导出的文件. sed -i 's/\x01/\t/g' file *`; do sed -i 's/\x01/\t/g' $f done