Last active
August 14, 2022 15:01
-
-
Save ambiamber/e0a07ba6a68240f68f1ffdca5fc0f5a1 to your computer and use it in GitHub Desktop.
List all stackexchange domains
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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