Getting a value from HTML format in Bash -
i want verify status become "ready" before performing next action. however, client return status in html format. how can "ready" value?
code
echo "$status"
output:
<reply><contents><status>ready</status> </contents> <status>ok</status> </reply>
looks you've got valid xml there. can ready
part out this:
xmllint --xpath '//contents/status/text()' file.xml
tempting may in relatively simple case use regular expression extract part you're interested in, recommend against it, wrong tool job , break input changes slightly. approach more flexible.
Comments
Post a Comment