1、需要对比清单
[root@ecs-MaxComputer-master001 ~/shell]# cat odps_file
ods_uat1 o_mpaas_monitor_performance etl_dt='20230626'
dwd_uat1 d_ed_wit_edu_cld_card_consm_flow_tab_di_20221103 etl_dt='20220716',etl_src_tab='O_TMIC_CARDTRADINGLOG'
2、执行脚本
#!/bin/bash
file=odps_file
pro='/root/odpscmd_src/bin/odpscmd'
dst='/root/odpscmd_dst/bin/odpscmd'
dir_pwd=`pwd`
dir_odps=$dir_pwd/odps
> $dir_odps/pro.txt
> $dir_odps/dst.txt
[ ! -d $dir_odps ] && mkdir -p $dir_odps
while read line
do
project=`echo $line|awk '{print $1}'`
tb_name=`echo $line|awk '{print $2}'`
par_name=`echo $line|awk '{print $3}'|sed 's/,/ and /g'`
sh $pro -e "use $project;select count(*) from $tb_name where $par_name" >> $dir_odps/pro.txt
sh $dst -e "use $project;select count(*) from $tb_name where $par_name" >> $dir_odps/dst.txt
done < $file