Skip to content

Instantly share code, notes, and snippets.

@ambiamber
Last active August 14, 2022 15:01
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 ambiamber/e0a07ba6a68240f68f1ffdca5fc0f5a1 to your computer and use it in GitHub Desktop.
Save ambiamber/e0a07ba6a68240f68f1ffdca5fc0f5a1 to your computer and use it in GitHub Desktop.
List all stackexchange domains
#! /bin/bash
# 1. Fetch web page with the stackexchange domains.
# 2. Extract the lines that have links to the domains.
# 3. Discard a bit of irrelevant HTML that gets through the awk statement.
# 4. Extract the URI. https://en.wikipedia.org/wiki/Uniform_Resource_Identifier
# 5. Remove the URI scheme. https://en.wikipedia.org/wiki/List_of_URI_schemes
curl -s https://stackexchange.com/sites?view=list \
| awk '/lv-item/{getline; print}' \
| grep -v '</style>' \
| cut -d '"' -f2 \
| sed 's;^.*https://;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment