Skip to content

Instantly share code, notes, and snippets.

@knudmoeller
Last active November 15, 2018 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knudmoeller/deb250b089a734894b86fdfc2fc5fe7d to your computer and use it in GitHub Desktop.
Save knudmoeller/deb250b089a734894b86fdfc2fc5fe7d to your computer and use it in GitHub Desktop.
Filtering stuff with grep, sed, etc.
# From an online DCAT catalog RDF/XML, get all dcat:accessURLs (likely the ressource URLs)
wget -q -O - https://datenregister.berlin.de/catalog.rdf | grep "dcat:accessURL" | grep -o '".*"' | sed 's/"//g'
# From an online JSON Schema, make HTML <option> elements for each member of the value enum of a given property
PROP_NAME="geographical_granularity"
curl -s https://datenregister.berlin.de/schema/berlin_od_schema.json | \
jq -r ".properties.${PROP_NAME}.enum[]" | \
sed 's/^\(.*\)$/<option value="\1">\1<\/option>/g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment