xml - Get xmllint to output xpath results \n-separated, for attribute selector -
how can xmllint output multiple results of xpath selector attributes "per line"?
take example:
<?xml version="1.0" encoding="iso-8859-1"?> <config> <tagx key1="value1 " key2=" value2"/> <tagy key3="value3" key4=" value4 "/> </config> $ xmllint example.xml --xpath "/config/*/@*"
the result is:
key1="value1 " key2=" value2" key3="value3" key4=" value4 "
what i'd is:
key1="value1 " key2=" value2" key3="value3" key4=" value4 "
would need split after even-numbered quote marks, or there neater way this?
there's related question, about same subject except it's picking out contents of <tag>value</tag>
, , not <tag attribute="value" />
you can try:
$ xmllint --shell inputfile <<< `echo 'cat /config/*/@*'`
you might need grep
output, though, filter undesired lines.
Comments
Post a Comment