여러 같은 레이블 배쉬에서 XML 파일을 구문 분석 : https://stackoverflow.com/a/7052168/6557127,하지만 내 XML 파일은 다른 비트 (openHAB REST API)입니다 : 나는 상태를 얻을 수있는 방법어떻게이 응답 읽고
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<items>
<item>
<type>GroupItem</type>
<name>All</name>
<state>baz</state>
<link>http://localhost:8080/rest/items/All</link>
</item>
<item>
<type>GroupItem</type>
<name>foo</name>
<state>bar</state>
<link>http://localhost:8080/rest/items/foo</link>
</item>
</items>
bash에있는 foo 항목? (쉘 함수 호출 여기서,) 파이썬 2.7
xmlstarlet sel -t -m "//item[name='foo']/state" -v .
... 또는 : XMLStarlet 함께
BTW - 문서 머리글에'xmlns ='선언이 있으면 의미가 변경됩니다. 반드시 포함 시키십시오. –