htmlq Command Examples

Use CSS selectors to extract content from HTML files. More information: https://github.com/mgdm/htmlq.

cat {{path/to/file.html}} | htmlq '.card'

cat {{path/to/file.html}} | htmlq --text 'p:first-of-type'

cat {{path/to/file.html}} | htmlq --attribute href 'a'

cat {{path/to/file.html}} | htmlq --remove-nodes 'img' --remove-nodes 'svg'

htmlq --pretty --filename {{path/to/input.html}} --output {{path/to/output.html}}