路径:$HOME/ggscript/ggrepeat
功能:该脚本为处理目标端因为源端重复配置源端表,导致目标端数据重复的问题而设计。可以针对进程检查重复配置的表名,并罗列具体信息和所在文件行数
可以配合note快速注释脚本进行源端重复表清理操作
#!/bin/bash echo "+--------------------------------------------------------+" echo "|This script will search for the repeat table ( by RenYi)|" echo "+--------------------------------------------------------+" if [ $# -eq 0 ]; then echo "REPEAT EXTRACT" exit 2 fi backuptime=`date +%Y%m%d-%H%M` datenow=`date +%Y%m%d%H` val=$1 val=`echo $val|tr a-z A-Z` echo "-------------------------" echo "The process name is $val" echo "-------------------------" val=`echo $val.PRM|tr A-Z a-z` cd $HOME/ggserver/dirprm if [ ! -e $val ]; then echo "the EXTRACT is not exist" exit 2 fi cd $HOME/ggscript/ggrepeat cat $HOME/ggserver/dirprm/$val|awk '/TABLE#/,/#TABLE/{if(i>1)print x;x=$0;i++}' > temp awk -F '--' '($1) { print $1}' temp > temp2 rm -rf temp sed -e '/^$/d' temp2 > temp3 rm -rf temp2 awk -F ',' '{print $1}' temp3 >temp4 rm -rf temp3 awk -F ';' '{print $1}' temp4 >temp5 rm -rf temp4 cat temp5|awk -F 'TABLE ' '{print $2}' > Temp rm -rf temp5 sort Temp |uniq -d > $HOME/ggscript/ggrepeat/tmp echo "-------------------------" echo "The repeat table:" echo "-------------------------" cat tmp i=1 num=`sed -n '$=' tmp` echo "num = $num" echo "-------------------------" echo "The Detailed results:" echo "-------------------------" while [ ! -n "$num" ] do echo "no result" exit 2 done while [ "$i" -le "$num" ] do TAL=`sed -n $i'p' tmp` echo $TAL grep -ni $TAL $HOME/ggserver/dirprm/$val ((i++)); done echo "-------------------------"
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。