0

Background

I am attempting to use a command, called xmllint to parse an html file for a specific value inside a tag. All of the examples I have seen online use the --html option alongside the --xpath option in order to parse like in @nwellnhof's example:

xmllint --html --xpath '/html/body/h1[1]' - <<EOF
<BODY>
<H1>Dublin</H1>
EOF

However, my local version of xmllint does not contain the --xpath option. I would like to figure out which version of the command I am using so I can parse html properly.

Question

How do I find which version of a command that I am using in linux?

isakbob
  • 1,439
  • 2
  • 17
  • 39
  • one convention is to ask the program with an argument,, i.e. `xmllint --version` or `xmllint -v` (or maybe `-V`). You may get some useful information from `type xmllint`. . There is another `c` programming utility that dumps all the function names from the binary and it may include other info, like a compile date, version, who knows what else, but for me that is 10 yrs ago, and I don't remember. Maybe someone else can think of some other ideas. If you're going to have to install new software to get your project going, then spend your effort getting `xmlstarlet`. ... – shellter Jul 03 '19 at 00:48
  • Or you'll have to learn a java, python or perl based object system that can parse xml. (I only know they exist, haven't used them). Read thru 50 `xml` Qs here and you'll find other technology names that might help you. Good luck. – shellter Jul 03 '19 at 00:50
  • If you installed `xmllint` using your distro's package manager you can also ask the package manager. For instance `pacman -Qi xmllint` on arch or `apt show xmllint` on ubuntu. – Socowi Jul 08 '19 at 14:28

0 Answers0