Created
November 8, 2016 21:08
-
-
Save jnv/806d5fc001afb5161ce09813df84ca2f to your computer and use it in GitHub Desktop.
Bulk check list of URLs with curl; outputs semicolon separated csv
This file contains hidden or 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 | |
# Usage: check-urls.sh <urls list> | |
# <urls list> is a text file with 1 URL per line | |
echo "url;http_code;url_effective;error" | |
while read -r LINE; do | |
echo -n "$LINE;" | |
curl -o /dev/null -sS --max-time 5 --write-out '%{http_code};%{redirect_url};' "$LINE" 2> >(sed -e 's/$/;/' | tr -d '\n' | tr -d '\r') | |
sync | |
echo "" | |
done < "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment