reorganization
[anna.git] / example / diameter / launcher / scripts / createBatch.sh
diff --git a/example/diameter/launcher/scripts/createBatch.sh b/example/diameter/launcher/scripts/createBatch.sh
new file mode 100755 (executable)
index 0000000..5599d52
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/ksh
+
+salir () {
+   echo
+   echo $1
+   echo
+   exit
+}
+
+uso () {
+   echo "Use: $0 <directory with .hex/.xml files> [operation]"
+   echo
+   echo "     operation: code|[decode]"
+   echo
+   echo "     Example: $0 Pending/NOKIA"
+   echo
+   salir
+}
+
+#############
+# EJECUCION #
+#############
+[[ "$1" = "" ]] && uso
+DIR=$1
+OP=$2
+[[ "$OP" = "" ]] && OP=decode
+[[ "$OP" != "decode" ]] && OP=code
+[[ ! -d $DIR ]] && salir "Directory $DIR not found"
+
+> batch.txt
+
+[[ "$OP" = "decode" ]] && { EXT1=hex ; EXT2=xml ; }
+[[ "$OP" = "code" ]] && { EXT1=xml ; EXT2=hex ; }
+
+for i in `find $DIR/ -name "*.${EXT1}"`
+do
+   echo ".\c"
+   echo "$OP|$OP|$i|${i}.${EXT2}" >> batch.txt
+done
+
+echo
+echo "Created batch.txt"
+echo
+