OGG运维优化脚本(六)-信息修改类--批量取消注释
短信预约 -IT技能 免费直播动态提醒
文件名:recomment.sh
路径: $HOME/ggscript/ggcomment
功能:该脚本用于批量取消注释,配合批量注释脚本使用,基本功能相反,操作步骤完全一致。通过edit脚本选择使用
日志路径:$HOME/gglog/ggcomment
#!/bin/bash
backuptime=`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 1
ls -lrt $HOME/ggserver/dirprm/*.prm
read -p "Please enter the prm file name:" val
echo "Please Enter the table you need to reannotate"
read -n 1
vi annotmp
echo "---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.bak
echo "backup the '$val' to the '$HOME/ggserver/dirprm/bak/$val.$backuptime.bak'" >> ''$HOME'/gglog/ggcomment/reannoLog-'$backuptime'.log'
echo ch
echo "Operating table you want to belong to what state?"
select ch in "parameter" "noparameter" "REPLICAT" "exit"
do
case $ch in
"parameter")
sed 's/^/TABLE /' annotmp > table1
sed 's/$/,/' table1 > table2
break;
;;
"noparameter")
sed 's/^/TABLE /' annotmp > table1
sed 's/$/;/' table1 > table2
break;
;;
"REPLICAT")
sed 's/^/MAP /' annotmp > table1
sed 's/$/,/' table1 > table2
break;
;;
"exit")
echo "process complete"
break;
;;
*)
echo "Please select your choice :"1.parameter" "2.noparameter" "3.REPLICAT" "exit""
;;
esac
done;
echo $TAL
i=1
num=`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'
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341