Skip to content

Instantly share code, notes, and snippets.

@knbknb
Last active August 3, 2025 16:39
Show Gist options
  • Select an option

  • Save knbknb/31b20db2357b41622d692eeb17e8eaaf to your computer and use it in GitHub Desktop.

Select an option

Save knbknb/31b20db2357b41622d692eeb17e8eaaf to your computer and use it in GitHub Desktop.
xpath: Curl & Xidel Query Snippets
# attribute values
curl -sL "${url}${urlparams}" \
| xidel -s -e "distinct-values(//node()[attribute::*])" \
| perl -ple 's/\s+$//' \
| cat -s -n | head -100
# attribute names
curl -sL "${url}${urlparams}" | xidel -s -e 'distinct-values(//@*)'
# element names in a document
curl -sL "${url}${urlparams}" | xidel -s -e "distinct-values(//*/name())" | xargs
# all Dublic-Core metadata from all *.svg documents in the current directory tree
grep -lR metadata * 2>/dev/null \
| xargs -i xidel -s -e '//metadata//dc:*/normalize-space()' {} \
| cat -s | more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment