反解析hdfs元数据分析hive分区文件统计

根据fsimage反解析出的hive表,查询出所有hive目录:
select path from hdfsinfo.fsimage_info_csv where path like ‘/user/hive/warehouse/%’;

1、#删除文件空格和|
sed -i ‘s/[[:space:]]||//g’ out.log
sed -i ‘s/// /g’ out.log
sed -i ‘s/^ //g’ out.log
删除包含特定字符行
sed -i ‘/±------------------/d’ out.log
sed -i ‘/^path/d’ out.log

2、#取最后一列正则匹配"=“,若最后一个列不包含”=“,最后一列设置为空串,再输出整行,若包含”=“则直接输出整行。
nohup cat out.log| awk -F ’ ’ '{if(KaTeX parse error: Expected '}', got 'EOF' at end of input: NF !~/=/) {NF=”";print $0;} else {print $0;}}’ | cut -c 21- >> Formatout.log 2>&1 &
3、#统计重复行数量
nohup sort Formatout.log | uniq -c | sed ‘s/1*//g’ | sort -rn >> SortFormatout.log 2>&1 &

命令细分解释:
uniq -c 统计重复次数,
sort-rn 识别每行开头的数字并降序,
cut -c 21- 取出每行第21个及其以后的字符。
sed ‘s/2*//g’ 去除前的tab


  1. \t ↩︎

  2. \t ↩︎

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值