So I have this xml line example, which is being read from ,
<element attr1=”XX” attr2=”0818820\.x11” attr3=”YYXX.x11” attr-4=”1”/>
As it is xml, the order of the elements are random and some may be optional.
So with awk I tried to select one of them, say attr1 using gensub.
while (getline < "./file") {
print $0
#First attempt
#print gensub(/.*attr1=\"(.*)\".*/,"\\1","g",$0)
#Second attempt
print gensub(/.*attr1="(.*)".*/,"\\1","g",$0)
}
However, I have not managed to match this, but the whole line is returned (probably no match but it can be match all as well). Anyone having an idea? I will not be able to modify the input arguments.
BR Patrik