From 612503aab486040698412a077ee19aa4900b91be Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Tue, 5 May 2020 19:37:41 +0200
Subject: [PATCH] Update the addFormatStringToPrefix.sh script.

---
 xml/addFormatStringToPrefix.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/xml/addFormatStringToPrefix.sh b/xml/addFormatStringToPrefix.sh
index 644a6e1..6485fae 100755
--- a/xml/addFormatStringToPrefix.sh
+++ b/xml/addFormatStringToPrefix.sh
@@ -1,10 +1,13 @@
 #!/usr/bin/env bash
 
-sub_path=//OpenGeoSysProject/time_loop/output/prefix
+base_path=//OpenGeoSysProject/time_loop/output
+sub_path=${base_path}/prefix
 prefix_value=`xmlstarlet sel -t -v $sub_path $1`
-prefix_format_string=${prefix_value}_pcs_{:process}_ts_{:timestep}_t_{:time}
+prefix_format_string=${prefix_value}_pcs_{:process_id}
+suffix_format_string=_ts_{:timestep}_t_{:time}
 
 xmlstarlet ed -u $sub_path -v $prefix_format_string $1 > /tmp/prefix.prj
+xmlstarlet ed -s ${base_path} --type elem -n suffix -v $suffix_format_string /tmp/prefix.prj > /tmp/suffix.prj
 
 #format the result file
-xmlstarlet fo -s 4 /tmp/prefix.prj > ${1}
+xmlstarlet fo -s 4 /tmp/suffix.prj > ${1}
-- 
GitLab