千家信息网

OGG运维优化脚本(六)-信息修改类--批量取消注释

发表于:2025-02-01 作者:千家信息网编辑
千家信息网最后更新 2025年02月01日,文件名:recomment.sh路径: $HOME/ggscript/ggcomment功能:该脚本用于批量取消注释,配合批量注释脚本使用,基本功能相反,操作步骤完全一致。通过edit脚本选择使用日志
千家信息网最后更新 2025年02月01日OGG运维优化脚本(六)-信息修改类--批量取消注释

文件名:recomment.sh

路径: $HOME/ggscript/ggcomment

功能:该脚本用于批量取消注释,配合批量注释脚本使用,基本功能相反,操作步骤完全一致。通过edit脚本选择使用

日志路径:$HOME/gglog/ggcomment

#!/bin/bashbackuptime=`date +%Y%m%d-%H%M`echo "This script is used to reannotate the specified table!(created by renyi)"echo $backuptime > ''$HOME'/gglog/ggcomment/reannoLog-'$backuptime'.log'read -n 1ls -lrt $HOME/ggserver/dirprm/*.prmread -p "Please enter the prm file name:"  valecho "Please Enter the table you need to reannotate"read -n 1vi annotmpecho "---reannotate table --------" > ''$HOME'/gglog/ggcomment/reannoLog-'$backuptime'.log'cat  annotmp  >>  ''$HOME'/gglog/ggcomment/annoLog-'$backuptime'.log'cp $HOME/ggserver/dirprm/$val $HOME/ggserver/dirprm/bak/$val.$backuptime.bakecho "backup the '$val' to the '$HOME/ggserver/dirprm/bak/$val.$backuptime.bak'"  >> ''$HOME'/gglog/ggcomment/reannoLog-'$backuptime'.log'echo checho "Operating table you want to belong to what state?"select ch in "parameter" "noparameter" "REPLICAT" "exit"docase $ch in"parameter")                sed 's/^/TABLE /' annotmp > table1                        sed 's/$/,/' table1 > table2break;;;"noparameter")                sed 's/^/TABLE /' annotmp > table1                        sed 's/$/;/' table1 > table2break;;;"REPLICAT")                sed 's/^/MAP /' annotmp > table1                        sed 's/$/,/' table1 > table2break;;;"exit")    echo "process complete"    break;;;*) echo "Please select your choice :"1.parameter" "2.noparameter" "3.REPLICAT" "exit"" ;;esacdone;echo $TALi=1num=`sed -n '$=' table2`while [ "$i" -le "$num" ]do        TAL=`sed -n $i'p' table2`        echo $TAL        echo --$TAL        sed "s/--$TAL/$TAL/g"  $HOME/ggserver/dirprm/$val    > tmp2        cat  tmp2 > $HOME/ggserver/dirprm/$val        ((i++));done  echo "process complete"  >> ''$HOME'/gglog/ggcomment/reannoLog-'$backuptime'.log'


0