result.csv,然后将结果导入到excel中,可是使用hive -e导出后默认的分隔符是\t,excel无法识别,所以需要将\t转成,方案一:使用linux管道符替换hive -e "select * from table limit 10" | sed 's/\t/,/g' > result.csv或者hive -e "select * from table limit 10" | tr "\t"_hive逗号分隔符">
赞
踩
业务场景:
做数据分析的时候,经常会用到hive -e "sql" > result.csv,然后将结果导入到excel中,可是使用hive -e
导出后默认的分隔符是\t
,excel无法识别,所以需要将\t
转成,
hive -e "select * from table limit 10" | sed 's/\t/,/g' > result.csv
或者
hive -e "select * from table limit 10" | tr "\t" "," > result.csv
insert overwrite local directory '/home/hadoop/20200521'
row format delimited
fields terminated by ','
select * from table limit 10;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。