From b3269acdadbe88d040be3fbf648491e583d92de9 Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Sun, 12 May 2024 03:15:15 +0200 Subject: [PATCH] stats.sh --- stats.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 stats.sh diff --git a/stats.sh b/stats.sh new file mode 100755 index 0000000..c41befa --- /dev/null +++ b/stats.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +if [ $# -ne 1 ] +then + echo "usage: $0 result-directory" + exit 0 +fi + +dir="$1" + +for i in $dir/* +do + Rscript ~/bin/summary.r $i > $i.r + rsum2line.awk $i.r > $i.raw +done + +# List raw files with the number of iterations as a prefix so they can then be sorted. +sort_raw_files() { + for i in $dir/*.raw + do + f $i + done | sort -n +} + +f() { + echo $* | sed "s/[_./]/ /g" | xargs echo "$* " | awk '{ printf "%s %s/%s_%s %s\n", $4, $2, $3, $5, $1 }' +} + +fill() { + while read LINE; do + nb_it=$(echo $LINE | awk '{ print $1 }') + target=$(echo $LINE | awk '{ print $2 }') + fname=$(echo $LINE | awk '{ print $3 }') + + cat $fname | xargs echo "$nb_it " >> $target.final + done +} + +sort_raw_files | fill