Adding sypet to repo
[Benchmarks_CSolver.git] / sypet-non-incremental / rename.sh
diff --git a/sypet-non-incremental/rename.sh b/sypet-non-incremental/rename.sh
new file mode 100755 (executable)
index 0000000..db2a40a
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+#Terminate the script if even one command fails
+set -e
+
+DIR=./learningset/
+DUMPS=$(find "$DIR" -name "*.dump")
+for d in $DUMPS; do
+       DUMPNAME=$(basename -- "$d")
+        DUMPNAME="${DUMPNAME%.*}"
+       GREPOUTPUT=$(grep -r "$DUMPNAME" | grep "log")
+       TNAME=""
+       if [[ $GREPOUTPUT == *"math"* ]]; then
+               TNAME="math"
+       elif [[ $GREPOUTPUT == *"geometry"* ]]; then
+               TNAME="geometry"
+        elif [[ $GREPOUTPUT == *"joda"* ]]; then
+                TNAME="joda"
+        elif [[ $GREPOUTPUT == *"xml"* ]]; then
+                TNAME="xml"
+       else
+               echo "Unknown Benchmark"
+               exit 1
+       fi
+       mv $DIR$DUMPNAME.dump $DIR$DUMPNAME-$TNAME.dump
+done