I have a bunch of Yandex.XML files with search results. http://api.yandex.com/xml/doc/dg/concepts/response.xml
I want to find out the queries (//yandexsearch/request/query
) for all such XML files where the first URL ((//yandexsearch/response/results/grouping/group/doc/url)[1]
) equals a certain value (say, http://www.example.org/
).
Drawing an analogy with grep
, I'd first use the -l
flag to list the matching documents, and then pipe such list to xargs xmllint
to extract the original query, but perhaps xmllint
(or another OS X tool) has a better way (plus, I haven't found xmllint
having a flag similar to -l
for the original matching in the first place).