diff --git a/xml/movePermeabilityFromSolidPhaseToMedium.sh b/xml/movePermeabilityFromSolidPhaseToMedium.sh new file mode 100755 index 0000000000000000000000000000000000000000..2068d2d1addbcecb45454b13b13bab959ddca81c --- /dev/null +++ b/xml/movePermeabilityFromSolidPhaseToMedium.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +#set -x + +number_of_medium_tags=`xmlstarlet sel -t -v "count(///*/medium)" $1` +number_of_medium_tags=$(($number_of_medium_tags - 1)) + +xmlstarlet ed --move "//OpenGeoSysProject/media/medium[@id=0]/phases/phase/properties/property[name='permeability']" "//OpenGeoSysProject/media/medium[@id=0]/properties" $1 > /tmp/t0.prj + +for i in `seq 1 ${number_of_medium_tags}`; +do + i_m_e=$(($i-1)) + #echo "${i}, ${i_m_e}" + path="//OpenGeoSysProject/media/medium[@id="${i}"]" + xmlstarlet ed --move "$path/phases/phase/properties/property[name='permeability']" "$path/properties" /tmp/t$i_m_e.prj > /tmp/t${i}.prj +done + +#format the result file +xmlstarlet fo -s 4 /tmp/t${number_of_medium_tags}.prj > ${1}