I have this line command with xmlstarlet to return how many name=$VALOR there is at the file client_state.xml. But I want to select a value with star, like $VALOR*
xmlstarlet sel -t -v "count(/client_state/workunit[name='$VALOR'])" client_state.xml
How do I do it?
Thanks
Felipe
I'm assuming by "with star" you mean to use the star as a wildcard. You can use the XPath function starts-with() for this case:
xmlstarlet sel -t -v "count(/client_state/workunit[starts-with(name, '$VALOR')])" client_state.xml