I'm trying to use xmllint to parse names of Solr cores from the configuration file. This works:
xmllint --xpath /solr/cores/core/@name solr.xml |grep -Po '(?<=name=")[a-z-]+(?=")'
And it returns something like:
core-a core-b ...
Which is exactly what I want, but I would like to eliminate grep. It seems like one should be able to do this with just xpath. Without grep, the output looks like:
name="core-a" name="core-b" ...
Wrapping the expressions in
string() reduces the multiple output to just the first (ie
core-a and that's it), which is not useful. How can I apply the
string function on each result?