X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=cluster_tools%2FmergeStatFile.sh;h=12c7c05ef12c79ac5de09503840099783d4f25eb;hb=cc9072c5acc18200fb3e34d22b4c1c2f823d18b1;hp=20eb20ae1f5c85a1b6cc662adcfa81a50bfc0652;hpb=ee43bd527de470c2d7651cfa4f6efee830b89de1;p=clitk.git diff --git a/cluster_tools/mergeStatFile.sh b/cluster_tools/mergeStatFile.sh index 20eb20a..12c7c05 100755 --- a/cluster_tools/mergeStatFile.sh +++ b/cluster_tools/mergeStatFile.sh @@ -1,6 +1,5 @@ #!/bin/bash set -u -set -e function usage { echo "$0 -i -j -o " @@ -16,12 +15,18 @@ IN1=$2 IN2=$4 RESULT=$6 -TMP=`mktemp ./temp-XXXXXXX` + +test -f ${IN1} && test -f ${IN2} || usage + +TMP="$(mktemp)" +echo "merging stat file" for PARAM in `awk '$1 == "#" {print $2}' ${IN1}` do + echo "merging ${PARAM}" V1=`awk -v P=${PARAM} '$2 == P {print $4}' ${IN1} ` V2=`awk -v P=${PARAM} '$2 == P {print $4}' ${IN2} ` R=`echo "${V1} + ${V2}" | bc` - echo "# ${PARAM} = ${R}" >> ${TMP} + test -z "${R}" && continue + echo "# ${PARAM} = ${R}" >> ${TMP} done mv -f ${TMP} ${RESULT}