You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
use xmlstarlet in shell script to read script variable value and insert in outpu xml file under specific section if the string is not present there
#252
Open
vivuu1989 opened this issue
Feb 19, 2024
· 0 comments
I know, I can use xmlstarlet to create element inside my outputpolicy.xml file as given below.
for g in $(eval echo \$${f}_apiname); do
echo " this policy will be applied to apis,$(eval echo \$${f}_apiname)"
done
if [ -z "$(eval echo \$${f}_inboundsession_)" ]; then
echo 'the inbound session is not present'
else
echo 'the inbound session is present and append the policy settings to inbound'
xmlstarlet ed -O -s '//inbound' -t elem -n rate-limit-by-key -i '//inbound/rate-limit-by-key' -t attr -n calls -v xx -i '//inbound/rate-limit-by-key' -t attr -n renewal-period -v yy -i '//inbound/rate-limit-by-key' -t attr -n counter-key -v '@(Regex.Match(context.x.y.GetValueOrDefault("xxxxxxx",""), @"^[.x-y]*")?.Value)' policy.xml > io_ou_ipfilter.xml
but what I am looking is use xmlstarlet in my script to read the output of the above script variable "$(eval echo $${f}inboundsession) and insert the given string under inbound session of the below policy.xml file if the string is not preset.
The parse yaml utility which I used in my shell script produces variables as below by eval command
I know, I can use xmlstarlet to create element inside my outputpolicy.xml file as given below.
but what I am looking is use xmlstarlet in my script to read the output of the above script variable "$(eval echo $${f}inboundsession) and insert the given string under inbound session of the below policy.xml file if the string is not preset.
Expected Output
The text was updated successfully, but these errors were encountered: