您好,登錄后才能下訂單哦!
路徑:$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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。