html-xml-utils Get a specific <tr> value

653 Views Asked by At

I am using Xubuntu 16.04.2 with html-xml-utils

I tried this command

hxnormalize -x site/sciz.html | hxselect 'table.vitals-table:first-child'

but it doesn't work, it outputs nothing. There are about 3-5 of these tables in the html.

Doing this outputs all the tables

hxnormalize -x site/sciz.html | hxselect 'table.vitals-table'

But I need to only get the first-child or nth-child(n) and it doesn't seem to work correctly.

I tried getting the second <tr> in the table with this

hxnormalize -x site/sciz.html | hxselect 'table.vitals-table tbody tr:nth-child(2)'

which deletes everything before the second <tr> but also prints everything after it.

I'm not sure what I'm not understanding about using :first/nth-child(n). Can someone please help? thanks

1

There are 1 best solutions below

0
On

Could you try to use :nth-of-type(2) instead?