Last active
January 7, 2021 18:20
-
-
Save laradevitt/fa3204d63c1b043f379f25e5f611b1fb to your computer and use it in GitHub Desktop.
Randomly selected sample - get a specified number of random entries from a website XML sitemap. Usage: ./random-from-sitemap.sh http://domain.com/sitemap.xml 10
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/sh | |
SITEMAP=$1 | |
COUNT=$2 | |
if [ "$SITEMAP" = "" ] || [ "$COUNT" = "" ]; then | |
echo "Usage: $0 https://example.com/sitemap.xml 1" | |
exit 1 | |
fi | |
curl $SITEMAP | grep -e loc | shuf -n $COUNT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment