From e7f6ef589423355d3577da5c40e23d054f232aec Mon Sep 17 00:00:00 2001 From: Pierre Gueth Date: Tue, 10 Jul 2012 16:18:41 +0200 Subject: [PATCH] just cp when all txt files are identical --- cluster_tools/gate_power_merge.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) 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|/*$||')" -- 2.47.1