Ogg Operations Optimization Script (ix)-Query maintenance class--process repeating table check

Source: Internet
Author: User

path : $HOME/ggscript/ggrepeat

function: This script is designed to deal with the problem that the target side repeatedly configures the source-side table, which causes data duplication on the target side. Duplicate configured table names can be checked against the process, listing specific information and the number of file rows

Source-side Duplicate table cleanup operation with note Quick note script

#!/bin/bashecho  "+--------------------------------------------------------+" echo  "| this script will search for the repeat table  ( by RenYi) | " echo  "+--------------------------------------------------------+" IF [ $# -EQ 0 ] ; then        echo  "Repeat extract"          exit 2fibackuptime= ' date +%y%m%d-%h%m ' datenow= ' Date +%Y%m%d%H ' val =$1val= ' 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/dirprmif [ ! -e  $val  ]; then         echo  "The extract is not exist"          exit 2ficd  $HOME/ggscript/ggrepeatcat  $HOME/ggserver/dirprm/$val |awk  '/table#/,/#TABLE/{if (i>1) print  x;x=$0;i++} '  > tempawk -F  '--'    ' ($  { print $1} '  temp  > temp2rm -rf tempsed  -e  '/^$/d '   temp2 >  temp3rm -rf temp2awk -f  ', '   ' {print $1} '  TEMP3 >TEMP4RM -RF  temp3awk -F  '; '   ' {print $1} '  temp4 >temp5rm -rf temp4cat temp5|awk  -F  ' table  '    ' {print $2} '  > temprm -rf temp5sort temp |uniq  -d >  $HOME/ggscript/ggrepeat/tmpecho  "-------------------------" echo  "the  Repeat table: "echo "-------------------------"cat tmpi=1num= ' sed -n  ' $= '  tmp ' echo  "num =  $num" echo  "-------------------------" echo  "the detailed resUlts: "echo "-------------------------"while [ ! -n " $num " ]doecho " no  Result "exit 2donewhile [ " $i " -le " $num " ]do         tal= ' sed -n  $i ' P '  tmp '         echo $ talgrep -ni  $TAL   $HOME/ggserver/dirprm/$val ((i++));d oneecho  "-------------------------"


This article is from the "Netsman" blog, make sure to keep this source http://netsman.blog.51cto.com/5750076/1939639

Ogg Operations Optimization Script (ix)-Query maintenance class--process repeating table check

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.