代码拉取完成,页面将自动刷新
#!/bin/bash
# Copyright xmuspeech (Author:Snowdar 2018-10-05)
trials= # if provided,score will be sorted as this trials' order
remove_inf=true
. subtools/parse_options.sh
if [[ $# != 2 ]];then
echo "[exit] Num of parameters is not equal to 2"
echo "usage:$0 [--remove-inf true | false] [--trials trials-path] <in-table> <out-score>"
exit 1
fi
table=$1
score=$2
>tmp.count
awk 'NR==1{
for(i=1;i<=NF;i++){
a[i]=$i
}
}
NR>1{
for(i=2;i<=NF;i++){
if($i=="-inf"){print $i >>"tmp.count"}
print a[i-1],$1,$i
}
}' $table > $score
num=`wc -l tmp.count | awk '{print $1}'`
echo "Num of -inf in $table is :$num"
if [ -s "$trials" ];then
>tmp.count
awk 'NR==FNR{a[$1$2]=$3}NR>FNR{if(!a[$1$2]||a[$1$2]=="-inf"){a[$1$2]="-inf";print a[$1$2] >>"tmp.count"} print $1,$2,a[$1$2]}' $score $trials > $score.tmp && \
mv $score.tmp $score
num=`wc -l tmp.count | awk '{print $1}'`
echo "Num of -inf with $trials is :$num (if != 0,then the num of valid trials in $table is less than target num of $trials)"
fi
if [ "$remove_inf" == "true" ];then
echo "Remove -inf ..." && sed -i '/-inf/d' $score
fi
rm -f tmp.count
echo "Transforming table to score done."
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。