Originally Posted by Tinkster
And welcome to LQ!
I'm not sure what the requirement is; is the name of the tag relevant at all,
or are you just looking for the first piece of VALUE after a value of 10?
If my trivial assumption above was correct this simple sed below would do:
echo "<blabla>..<blabla/><blabla>..<blabla/><parm1>10</parm1><parm2>20<parm2/><blabla>..<blabla/><blabla>..<blabla/>"| sed -r 's/.+10<.+>([0-9]+).+/\1/g'
Hi, Tink !
First of all, thanks for the reply !
my string looks like following:
long part befor in this string...<dscpService>0</dscpService><Enable>1</Enable>...long part afterwards
So, I should find first the tag <dscpService>0</dscpService> , which is uniq in this xml file and direct afterwards comes the Enable Flag which could be 0=off or 1=on. So I need to read the Enable flag or to define it in a parm.
hope thats a better description,