From e5ee11a7495615f072347d205bdc858c1b4b5629 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Thu, 30 Apr 2020 15:13:28 +0200
Subject: [PATCH] Script to add format string prefix tag of the OGS project
 file.

---
 xml/addFormatStringToPrefix.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100755 xml/addFormatStringToPrefix.sh

diff --git a/xml/addFormatStringToPrefix.sh b/xml/addFormatStringToPrefix.sh
new file mode 100755
index 0000000..644a6e1
--- /dev/null
+++ b/xml/addFormatStringToPrefix.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+sub_path=//OpenGeoSysProject/time_loop/output/prefix
+prefix_value=`xmlstarlet sel -t -v $sub_path $1`
+prefix_format_string=${prefix_value}_pcs_{:process}_ts_{:timestep}_t_{:time}
+
+xmlstarlet ed -u $sub_path -v $prefix_format_string $1 > /tmp/prefix.prj
+
+#format the result file
+xmlstarlet fo -s 4 /tmp/prefix.prj > ${1}
-- 
GitLab