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

java - HTTP Status 500 - An exception occurred processing JSP page /second.jsp at line 15 -

php - Using str_replace to translate a MySQL Table in html -

asp.net mvc - Cannot display error message on Editor or EditorFor -