Skip to content

Instantly share code, notes, and snippets.

@blip-lorist
Last active January 7, 2017 20:13
Show Gist options
  • Save blip-lorist/b97bedf34ddfbacdfffdfbefe54401f9 to your computer and use it in GitHub Desktop.
Save blip-lorist/b97bedf34ddfbacdfffdfbefe54401f9 to your computer and use it in GitHub Desktop.
URL status checker
Input:
A text file with a URL on each line. Example url-list.txt:
http://blah.com
http://blah2.com
Run:
while read url; do curl -I $url 2> /dev/null | head -n1 | awk -v url=$url '{print $2, url}'; done < url-list.txt > link-statuses.txt
Output:
link-statuses.txt
200 http://blah.com
404 http://blah2.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment