Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

OGG Operation and maintenance Optimization script (5)-Information Modification Class-batch comments

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

File name: comment.sh

Path: $HOME/ggscript/ggcomment

Function: the script is designed based on the database monthly large number of annotated source tables for data cleaning, requiring data synchronization with a large number of annotated configuration tables.

Select and call through the edit script

Log path: $HOME/gglog/ggcomment

#! / bin/bashbackuptime= `date +% Y% m% dmurf% H% M`echo "This script is used to annotate the specified table! (created by renyi)" echo $backuptime >''$HOME'/gglog/ggcomment/InsertLog-'$backuptime'.log'read-n process "enter the filename of the E process that requires batch comments (at the end of prm) ls-lrt $HOME/ggserver/dirprm/e*.prmread-p" Please enter the prm file name: "val# enter the table name you need to comment Do not add TABLE and semicolon echo "Please Enter the table you need to annotate" read-n 1vi annotmpecho "--annotate table -" >''$HOME'/gglog/ggcomment/annoLog-'$backuptime'.log'cat annotmp > >'$HOME'/gglog/ggcomment/annoLog-'$backuptime'.log'# backup prm configuration file 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/annoLog-'$backuptime'.log'# Select operation type echo checho" Operating table you want to belong to what state? "select ch in" parameter "" noparameter "" REPLICAT "" exit "do# all need to be annotated table with parameter case $ch in" parameter ") sed's / ^ / TABLE / 'annotmp > table1 sed's account / / 'table1 > table2break ;; # all tables need to be annotated without the parameter "noparameter") sed's / ^ / TABLE / 'annotmp > table1 sed's' table1 > table2break;;; "exit") echo "process break" exit 2 politics *) echo "Please select your choice:" 1.parameter "2.noparameter"exit"; esacdone Echo $TALi=1num= `sed-n'$= 'table2` # Annotation Operation while ["$I"-le "$num"] do TAL= `sed-n $iSecretp`table2` # echo $TAL # echo-- $TAL sed "s/$TAL/--$TAL/g" $HOME/ggserver/dirprm/$val > tmp2 cat tmp2 > $HOME/ggserver/dirprm/$val ((iTable2`)); done echo "process complete" > >' $HOME'/gglog/ggcomment/annoLog-'$backuptime'.log'

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report