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

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -