bash 스크립트로 xml 파서를 저장할수있나요?
글쓴이: rhehfl2 / 작성시간: 금, 2013/01/25 - 1:23오후
<dict> <key>curKey</key> <string>1</string> <key>hostList</key> <dict> <key>1</key> <dict> <key>xx</key> <string>xxxx</string> <key>xx</key> <string>xxxx</string> <key>xxxx</key> <string>xxxx</string> <key>xxxx</key> <string>xxxxx</string> </dict> <key>1_1</key> <dict> <key>xx</key> <string>xxxx</string> <key>xx</key> <string>xxxx</string> <key>xxxx</key> <string>xxxx</string> <key>xxxx</key> <string>xxxxx</string> </dict> <key>2</key> <dict> <key>xx</key> <string>xxxx</string> <key>xx</key> <string>xxxx</string> <key>xxxx</key> <string>xxxx</string> <key>xxxx</key> <string>xxxxx</string> </dict> .........
현재 xml 문서입니다.
제가 가져와야 되는부분은 두번째 dict의 key값 (1, 1_1, 2)입니다.
이걸 가져오기 위해
cat serverList.plist |
getElementViaXPath --path='/dict/dict' |
sed -e 's%(^|$)%%g' > aa.txt
를 했는데, getElementViaXpath부분에서 에러가 발생하더군요...
이방법이 잘못된거 같은데 틀린 부분이나 혹은 다른 방법으로 해결할 수 있을까요?
Forums:
읔.. 저장형식을 잘못저장해서
<>안의 것들이 전부 날라갔네요..
최상위노드는 <dict
hostlist밑에 두번째노드 <dict 그리고 1이 두번째노드 안의 <key입니다.
< code > 내용 < /code > 와 같이
< code > 내용 < /code > 와 같이 하시면 코드들을 표현할수 있습니다.
http://stackoverflow.com/ques
http://stackoverflow.com/questions/893585/how-to-parse-xml-in-bash
χxχ=χ^2
GIS SW 개발자
댓글 달기