收藏文章 楼主

筛选日志 分析正确率

版块:自动化运维linux   类型:普通   作者:小绿叶技术博客   查看:1448   回复:0   获赞:8   时间:2022-12-19 13:01:30


#!/bin/bash

cishu=30
lable=3



set_config_log(){
   jieguofile=tongji-$i

   tongjifile="tongji.txt"

   charulog=("`n="0x1" ; cat $i | grep "nEventType" |grep -v JT | awk -v awknr="$n" '$NF==awknr' | awk -F"," '{print $4 "," $5}' |uniq -c | sort -n`")
   charu=(` n="0x1" ; cat $i | grep "nEventType" |grep -v JT | awk -v awknr="$n" '$NF==awknr' | awk -F"," '{print $4 "," $5}' |uniq -c | sort -n  | awk -F" " '{print $1}' `)
   charu=`echo ${charu[*]} | sed "s/ /+/g"` ; charu=$[charu]
   charulv=`echo "" | awk -v charu="$charu" -v cishu="$cishu" '{printf "%0.2f",charu/cishu*100}'` ;  charulv=${charulv:0:4} 

   lablelist=$(n="0x1" ; cat $i | grep "nEventType" |grep -v JT | grep "labelNum = $lable" | awk -v awknr="$n" '$NF==awknr' | awk -F"," '{print $4 "," $5}' |uniq -c | sort -n)
   lablegs=$(echo $lablelist | awk -F" " '{print $1}') ; lablegs=`echo "" | awk -v lablegs="$lablegs" -v cishu="$cishu" '{printf "%0.2f",lablegs/cishu*100}'` ; lablegs=${lablegs:0:4}

   bachulog=("`n="0x2" ; cat $i | grep "nEventType" |grep -v JT | awk -v awknr="$n" '$NF==awknr' | awk -F"," '{print $4 "," $5}' |uniq -c | sort -n`")
   bachu=(` n="0x2" ; cat $i | grep "nEventType" |grep -v JT | awk -v awknr="$n" '$NF==awknr' | awk -F"," '{print $4 "," $5}' |uniq -c | sort -n  | awk -F" " '{print $1}' `)
   bachu=`echo ${bachu[*]} | sed "s/ /+/g"` ; bachu=$[bachu]

   bachulv=`echo "" | awk -v bachu="$bachu" -v cishu="$cishu"  '{printf "%0.2f",bachu/cishu*100}' ` ; bachulv=${bachulv:0:4} 



   echo "#-------------- $i  ---------------# " >> $tongjifile

   echo "  测试次数:$cishu   识别插入次数: $charu    识别插入正确率: $charulv %     识别拔出次数: $bachu    识别拔出识别率:$bachulv %  贴标签个数: $lable   正确识别标签率:$lablegs %  " >> $jieguofile
   echo "  测试次数:$cishu   识别插入次数: $charu    识别插入正确率: $charulv %     识别拔出次数: $bachu    识别拔出识别率:$bachulv %  贴标签个数: $lable   正确识别标签率:$lablegs %  " >> $tongjifile
   echo " "  >> $tongjifile
 
 
   echo "
   #----------- 识别插入日志 -------------#
   ${charulog[*]}

   #----------- 识别拔出日志 ------------#
   ${bachulog[*]}

   #----------  识别标签正确日志 ------------#
   $lablelist

   " >> $jieguofile
 }
 
 runset(){
   file=(`ls | grep log | grep -v tongji`)
   
   for i in ${file[*]}
   do
      set_config_log 
   done
 }
 runset
 
 
 





有些梦虽然遥不可及,但并不是不可能实现。 
回复列表
默认   热门   正序   倒序

回复:筛选日志 分析正确率

Powered by ddoss.cn 12.0

©2015 - 2024 ddoss

头像

用户名:

粉丝数:

签名:

资料 关注 好友 消息