一.自动输出中文字符集 select * from db into outfile 'test.csv' CHARACTER SET gbk fields terminated by ',' optionally enclosed by '"' escaped by '"' lines terminated by '\r\n'; 二.导出后转换字符集 转换成CSV文件,如果乱码将CSV已记事本打开另存为UTF8 select * from db into outfile 'test.c
#!/bin/bash #用途: #.当前目录的txt文件批量转csv #.制表符转逗号分隔符 #.NULL去除 #.删除WARN警告 for i in `ls ./*.txt` do sed -e 's/\t/,/g' -e 's/NULL//g' -e '/^WARN:/d' $i >$i.csv done
命令 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里打印的内容输出到文件
PS : 用到spire库,.net控制台应用程序 其实本来没打算写这个工具的,只是最近需要用到,手头上正好没有这样的工具,那么怎么办,写呗! 其实说白了就是省事,策划想怎么玩,把表把工具丢给他,省得策划两分钟来拍一次你的后背,哈哈哈! 下面附上代码,注释得很清楚,我挑需要注意的说一下就好... 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using
说明: CentOS 7的服务systemctl脚本存放在:/usr/lib/systemd/,有系统(system)和用户(user)之分,像需要开机不登陆就能运行的程序,就将程序存在系统服务里,即:/usr/lib/systemd/system目录下 该目录下的服务有以service结尾的,也有target结尾的. service :守护进程的启动.停止.重启和重载是此类 unit 中最为明显的几个类型. target :此类 unit 为其他 unit 进行逻辑分组.它们本身实际上并不做什