Hive表导出成csv文件

hive -e "
set hive.cli.print.header=true;  #将表头输出 
select * from data_table where some_query_conditions
" | sed 's/[\t]/,/g'  > hhd.csv

set hive.cli.print.header=true将表头输出;
sed 's/[\t]/,/g' 将\t替换成,
> 将shell里打印的内容输出到文件

 

shell命令,转码

iconv -f UTF-8 -c  -t GBK xsh001.csv > xsh0001.csv

 

posted on 2021-11-09 10:32  架构艺术  阅读(675)  评论(0编辑  收藏  举报