近一万张标签,组长嫌弃打的太抖了,于是辛苦我一人,造福所有队员——写一个脚本把特定名字的标签框删除,就是苦了我的头发qaq


首先,经过探讨之后发现,如果要删除标签框,只需要删除对应json文件中对应的shapes,
所以具体要求如下:
1.需要删除lable名为Red1-8和Blue1-8的shapes内容
2.保留其他标签框:Dark和Red0和Blue0

第一版

#!/bin/bash
cd /home/computer/下载/label-json#这里是放着错误lable的json文件的地方,可以根据自己的情况改变
#FIND_STR="Blue1"a=5341while [ $a -lt 17121 ]   doif [ -f $a.json ] then #删除Red1while [ `grep -c \"Red1\" $a.json` -ne '0' ];do       m=$(sed -n '/"Red1"/=' $a.json | head -1)if [ $m -ne '6' ]then  top=`expr $m - 2`buttom=`expr $m + 21`sed -i "$top,$buttom d" $a.jsonecho "delete Red1 in $a"elsesed -i "5,28d" $a.jsonecho "delete Red1 in $a"fidonefi      ((a=a+1))done

json文件内容

第一次取的样本较少,看到的json文件大概是是以上模样,于是开始删除的时候只考虑到两种情况:

  • 1.删除的标签框是第一个标签框:删除第6-28行
  • 2.删除的标签框不是第一个标签框:删除lable向上2行和向下21行

但是问题很快就产生了

因为发现大家打的标签的版本不同,于是导致lable的位置和要删除的行数不同
如下:





第二版

无奈之下只好写第二版,组长给另一个方法:利用大括号匹配来删除,但是可惜的是我的栈实在学的不咋样,于是只好采用更复杂的代码

删除单个标签

#!/bin/bash
cd /home/computer/下载/label-json
#这里是放着错误lable的json文件的地方,可以根据自己的情况改变#大家打的标签
#1/3508 : 5.0.1 ----Red0/Blue5
#5008 - 5340 : 3.16.7-----Blue2/..
#11008 - 12007 : 4.5.9------Blue5/..
#14008 - 15007 : 4.5.12-----../Blue0/Red0
#16008 - 16536: 3.16.2 buttom-----Blue3/..
#16537 - 17121 :3.16.2 top-------../Blue6
#1-17121其余是:5.0.2#我写的垃圾代码a=1            #第一张标签叫:1.jsonwhile [ $a -lt 17122 ]         #最后一张标签叫:17121.jsondoif [ -f $a.json ]       #判断是否存在这张标签then #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Blue1\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do       mid=$(sed -n '/"Blue1"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];   #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue1 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue1 in $a"fidonefi        ((a=a+1))done

这样是匹配括号,就可以避免删错了行的问题,具体运行以下:

第三版

第二版可行,于是整合开始第三版,最终定稿
#!/bin/bash
cd /home/computer/下载/label-json
#这里是放着错误lable的json文件的地方,可以根据自己的情况改变#大家打的标签
#1/3508 : 5.0.1 ----Red0/Blue5
#5008 - 5340 : 3.16.7-----Blue2/..
#11008 - 12007 : 4.5.9------Blue5/..
#14008 - 15007 : 4.5.12-----../Blue0/Red0
#16008 - 16536: 3.16.2 buttom-----Blue3/..
#16537 - 17121 :3.16.2 top-------../Blue6
#1-17121其余是:5.0.2#我写的垃圾代码a=1            #第一张标签叫:1.jsonwhile [ $a -lt 17122 ]         #最后一张标签叫:17121.jsondoif [ -f $a.json ]       #判断是否存在这张标签then #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Blue1\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do       mid=$(sed -n '/"Blue1"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];   #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue1 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue1 in $a"fidone
#------------------Blue2------------------------------------------------            #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Blue2\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do       mid=$(sed -n '/"Blue2"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];   #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue2 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue2 in $a"fidone
#---------Blue3--------------------------------------------------------     #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Blue3\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do       mid=$(sed -n '/"Blue3"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];   #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue3 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue3 in $a"fidone#----------------Blue4-------------------------------------------------------------   #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Blue4\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do       mid=$(sed -n '/"Blue4"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];   #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue4 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue4 in $a"fidone
#-------------------Blue5----------------------------------------------------       #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Blue5\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do       mid=$(sed -n '/"Blue5"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];   #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue5 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue5 in $a"fidone
#------------------Blue6----------------------------------------------------------      #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Blue6\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do       mid=$(sed -n '/"Blue6"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];   #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue6 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue6 in $a"fidone
#--------------------------Blue7------------------------------------------      #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Blue7\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do       mid=$(sed -n '/"Blue7"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];   #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue7 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue7 in $a"fidone
#----------------------------Blue8-----------------------------------       #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Blue8\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do       mid=$(sed -n '/"Blue8"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];   #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue8 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Blue8 in $a"fidone
#--------------------------Red1------------------------------       #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Red1\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do        mid=$(sed -n '/"Red1"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];    #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red1 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red1 in $a"fidone
#--------------------------Red2------------------------------       #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Red2\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do        mid=$(sed -n '/"Red2"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];    #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red2 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red2 in $a"fidone
#--------------------------Red3------------------------------       #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Red3\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do        mid=$(sed -n '/"Red3"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];    #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red3 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red3 in $a"fidone
#--------------------------Red4------------------------------       #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Red4\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do        mid=$(sed -n '/"Red4"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];    #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red4 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red4 in $a"fidone
#--------------------------Red5------------------------------       #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Red5\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do        mid=$(sed -n '/"Red5"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];    #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red5 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red5 in $a"fidone
#--------------------------Red6------------------------------       #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Red6\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do        mid=$(sed -n '/"Red6"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];    #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red6 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red6 in $a"fidone
#--------------------------Red7------------------------------       #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Red7\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do        mid=$(sed -n '/"Red7"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];    #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red7 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red7 in $a"fidone
#--------------------------Red8------------------------------       #while循环,保证每一张标签里面的不需要的标签框都可以删完再转到下一个标签去删标签框while [ `grep -c \Red8\" $a.json` -ne '0' ] #判断这张标签里是否在"Red1-8"或者"Blue1-8"这个字符do        mid=$(sed -n '/"Red8"/=' $a.json | head -1)#获得第一次出现这个字符的位置lable_top=$midtop=$(sed -n "$mid p" $a.json | grep "{" )lable_flag1=0#{存在的标识while [ $lable_flag1 -ne '1' ];    #判断标识是否为1do#以下是获取这个字符前面出现的第一个未被匹配的{的行数lable_top=`expr $lable_top - 1`top=$(sed -n "$lable_top p" $a.json | grep "{" )top_buttom=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$top" ]thenlable_flag1=`expr $lable_flag1 + 1`echo "have { in $lable_top"fiif [ -n "$top_buttom" ]thenlable_flag1=`expr $lable_flag1 - 1`echo "have } in $lable_top"fiif [ $lable_flag1 -eq '1' ]thenecho "The top is $lable_top"fidonelable_buttom=$midbuttom=$(sed -n "$mid p" $a.json | grep "}" )lable_flag2=0#}存在的标识while [ $lable_flag2 -ne '1' ];  #判断标识是否为1do#以下是获取这个字符后面出现的第一个未被匹配的}的行数lable_buttom=`expr $lable_buttom + 1`buttom=$(sed -n "$lable_buttom p" $a.json | grep "}" )buttom_top=$(sed -n "$lable_buttom p" $a.json | grep "{" )if [ -n "$buttom" ]thenlable_flag2=`expr $lable_flag2 + 1`echo "have } in $lable_buttom"fiif [ -n "$buttom_top" ]thenlable_flag2=`expr $lable_flag2 - 1`echo "have { in $lable_buttom"fiif [ $lable_flag2 -eq '1' ]thenecho "The buttom is $lable_buttom"fidone#分析:#当这个标签框前面有一个不需要删除的标签时,删除的位置向上移动一行#当这个标签就是第一个标签框时,只需要删除匹配好的{}位置lable_top=`expr $lable_top - 1`flag=$(sed -n "$lable_top p" $a.json | grep "}" )if [ -n "$flag" ]thenlable_buttom=`expr $lable_buttom - 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red8 in $a"elselable_top=`expr $lable_top + 1`sed -i "$lable_top,$lable_buttom d" $a.jsonecho "delete Red8 in $a"fidonefi      ((a=a+1))done

这是我写shell以来写的最麻烦的脚本啦,原理不复杂,就是有点烦,在这里感谢组长 ,没有他也就没有这个脚本。

利用shell删除labelme打错的标签相关推荐

  1. linux遍历目录删除指定文件,利用shell脚本遍历文件夹内所有的文件并作整理统计的方法-linux删除文件夹...

    本篇文章扣丁学堂Linux培训小编给读者们分享一下利用shell脚本遍历文件夹内所有的文件并作整理统计的方法,文章具有很好的参考价值,感兴趣的小伙伴就随小编来了解一下吧. 环境: Ubuntu下采用s ...

  2. mysql shell可视化_shell编程系列24--shell操作数据库实战之利用shell脚本将文本数据导入到mysql中...

    shell编程系列24--shell操作数据库实战之利用shell脚本将文本数据导入到mysql中 利用shell脚本将文本数据导入到mysql中 需求1:处理文本中的数据,将文本中的数据插入到mys ...

  3. Linux7081端口,bash,linux_利用shell将json数据解析后排序问题,bash,linux,ubuntu,json - phpStudy...

    利用shell将json数据解析后排序问题 最近在写一个模仿dropbox_uploader的百度网盘的shell脚本.通过调用pcs的api返回一个目录下的所有文件.返回的json数据如下: {&q ...

  4. linux 循环显示所有的sh.*文件.,利用shell脚本遍历文件夹内所有的文件并作整理统计的方法...

    环境: Ubuntu下采用shell脚本实现 案例简述:文件夹内有许多子文件夹,这里需要自动读取所有的文件,包括他们的地址和文件名.通过观察文件名的规律,按照一定的规则裁剪出文件名的某一部分,该部分为 ...

  5. php 删除特殊符号,利用PHP删除特殊符号

    在编程的时候,不管你是偏向PHP等较为简单的编程,还是说想Java等更需要逻辑的强类型语言编程,都会或多或少地接触到对特殊符号的处理.特殊符号虽然显得不怎么起眼,但却极有可能会让程序实现不了初衷的目的 ...

  6. 利用shell脚本将json文件导入es

    现要将保存在一个目录下所有后缀名为json文件导入es集群,每个json文件中都按回车行分隔的json数据,下面是利用shell脚本完成此功能的代码. 在运行脚本之前,先创建索引. [root@nod ...

  7. linux在指定行添加内容,linux下利用shell在指定的行添加内容的方法

    linux下利用shell在指定的行添加内容的方法 在linux的一些配置中总会要进行某个文件中的某行的操作,进行增加,修改,删除等操作. 而这里主要是进行的是指定的行添加数据的操作: 脚本如下: s ...

  8. 【Python数据分析】利用Python删除EXCEL表格中指定的列数据或行数据

    如何利用Python删除EXCEL表格中指定的列数据?今天与大家一起分享一下DataFrame对象的drop()函数,drop()函数可根据标签删除EXCEL表格中的列数据或行数据,其语法格式如下: ...

  9. 利用shell监控云服务器文件夹变化

    利用shell监控云服务器文件夹变化 简介 这个代码的主要功能是对一台linux服务器(我使用的为centos7版本)的某个文件夹进行监控,当这个文件夹发生变化时(比如有对文件的增,删,改操作),那么 ...

  10. 利用 shell 脚本进行android 马甲包制作

    最近公司需要进行马甲包的制作,一开始想拉分支来解决,发现这样的做法不是很好,如果是多个马甲包呢?需要拉N个分支,一旦源代码动了,马甲包代码也要跟着动,而且还会产生很多冲突,多个地方需要操作起来,费时费 ...

最新文章

  1. Javascrapy的window onload()函数用法
  2. golang版try..catch..
  3. SESSION常见问题辑
  4. android手机 环境变量 文件,【图片】【教程】配置安卓Java环境变量【手机端反编译吧】_百度贴吧...
  5. Spring Boot学习总结(15)——Spring Boot优缺点再总结
  6. can't get master address from zookeeper /新旧数据不一致
  7. Oracle备份数据库
  8. mabatis的工作原理
  9. DNN硬件加速器设计3 -- DNN Accelerators(MIT)
  10. Apache Spark 完全替代传统数仓的技术挑战及实践
  11. c语言一个数平方表示,C语言 - 利用 汇编思想 写一个数的平方
  12. Unity3D游戏开发初探—3.初步了解U3D物理引擎
  13. 数据采集卡采样率M Sa/s 与G Sa/s是什么意思
  14. win10桌面计算机在哪里打开,Win10计算器在哪里?三种可以打开Win10计算器的方法图文介绍...
  15. 2022登高架设考题及在线模拟考试
  16. Ambari源码二次开发实战课程(持续更新中)
  17. poj-2491-Scavenger Hunt
  18. Skills | latex 从下载到运行通过
  19. 【大学物理·恒定电流的磁场】带电粒子在电场和磁场中的运动
  20. superset使用(四) 地图绘制的ISO 3166转码以及名称汉化显示

热门文章

  1. 大话存储系列19——数据容灾
  2. Synonyms 中文近义词工具包 -- 支持文本对齐,推荐算法,相似度计算,语义偏移,关键字提取,概念提取,自动摘要,搜索引擎等
  3. AR+AI的这些落地应用 你居然不知道?
  4. 冯扬文:基于数据仓库的集装箱运价信息集成研究
  5. 结构体初始化的四种方法
  6. 一文教你学会DIY串口线
  7. 如何在Mac上打开和使用AirPlay,以便在更大的显示器上进行屏幕镜像?
  8. sqlmap注入之tamper绕过WAF防火墙过滤
  9. python语言count什么意思_python中count函数是什么意思?
  10. java 避免gc_减少JAVA GC