exit 1
}
+warning_count=0
function warning {
-echo "WARNING: $1"
+let "warning_count++"
+echo "MERGE_WARNING: $1"
}
function start_bar {
local count="${1:?"provide count"}"
local message="${2:?"provide message"}"
local percent=$(echo "100*${count}/${count_max}" | bc)
-printf "[%03d/%03d] %3d%% %-80.80s\r" ${count} ${count_max} ${percent} "${message}"
+#printf "[%03d/%03d] %3d%% %-80.80s\r" ${count} ${count_max} ${percent} "${message}"
+printf "[%03d/%03d] %3d%% %-80.80s\n" ${count} ${count_max} ${percent} "${message}"
}
function end_bar {
unset count_max
-echo -ne '\n'
+#echo -ne '\n'
}
rootMerger="clitkMergeRootFiles"
echo " ${indent}entering root merger"
echo " ${indent}merger is ${rootMerger}"
echo " ${indent}creating ${merged}"
+#echo "######## $#"
+#echo "######## $*"
+
+if test $# -eq 1
+then
+ echo " ${indent}just one partial file => just copy it"
+ cp "$1" "${merged}"
+ return
+fi
+
local count=0
local arguments=" -o ${merged}"
while test $# -gt 0
fi
fi
+ if test "${firstpartialoutputextension}" == "txt"
+ 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
+ fi
+
warning "unknown file type"
}
+echo "!!!! this is $0 v0.3g !!!!"
+
rundir="${1?"provide run dir"}"
+rundir="$(echo "${rundir}" | sed 's|/*$||')"
nboutputdirs="$(find "${rundir}" -mindepth 1 -type d -name 'output*' | wc -l)"
test ${nboutputdirs} -gt 0 || error "no output dir found"
test -d "${outputdir}" && rm -r "${outputdir}"
mkdir "${outputdir}"
-for outputfile in $(find "${rundir}" -regextype 'posix-extended' -type f -regex '.*\.(hdr|root|txt)' | awk -F '/' '{ print $NF }' | sort | uniq)
+for outputfile in $(find "${rundir}" -regextype 'posix-extended' -type f -regex "${rundir}/output.*\.(hdr|root|txt)" | awk -F '/' '{ print $NF; }' | sort | uniq)
do
- merge_dispatcher "${outputfile}"
+ merge_dispatcher "${outputfile}"
done
+if [ -f "${rundir}/params.txt" ]
+then
+ echo "copying params file"
+ cp "${rundir}/params.txt" "${outputdir}/params.txt"
+fi
+
+echo "these was ${warning_count} warning(s)"