From: Pierre Gueth Date: Tue, 10 Jul 2012 14:18:41 +0000 (+0200) Subject: just cp when all txt files are identical X-Git-Tag: v1.4.0~177^2~11 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=e7f6ef589423355d3577da5c40e23d054f232aec;p=clitk.git just cp when all txt files are identical --- diff --git a/cluster_tools/gate_power_merge.sh b/cluster_tools/gate_power_merge.sh index 31f9158..8949b35 100755 --- a/cluster_tools/gate_power_merge.sh +++ b/cluster_tools/gate_power_merge.sh @@ -272,15 +272,24 @@ function merge_dispatcher { then echo "${indent}this is a non specific txt output" local mergedfile="${outputdir}/$(basename "${firstpartialoutputfile}")" - echo " ${indent}catting ${mergedfile}" - cat ${partialoutputfiles} > "${mergedfile}" || error "error while merging" - return + local nbdifferent="$(md5sum ${partialoutputfiles} | awk '{ print $1; }' | sort | uniq | wc -l)" + echo " ${indent}${nbdifferent} different files" + if test ${nbdifferent} -gt 1 + then + echo " ${indent}catting to ${mergedfile}" + cat ${partialoutputfiles} > "${mergedfile}" || error "error while merging" + return + else + echo " ${indent}moving to ${mergedfile}" + cp "${firstpartialoutputfile}" "${mergedfile}" || error "error while merging" + return + fi fi - warning "unknown file type" + error "unknown file type" } -echo "!!!! this is $0 v0.3h !!!!" +echo "!!!! this is $0 v0.3i !!!!" rundir="${1?"provide run dir"}" rundir="$(echo "${rundir}" | sed 's|/*$||')"