Skip to content

Instantly share code, notes, and snippets.

@yatishbalaji
Created February 20, 2023 06:38
Show Gist options
  • Select an option

  • Save yatishbalaji/d27e135da45418cf2c4579e6ff400e46 to your computer and use it in GitHub Desktop.

Select an option

Save yatishbalaji/d27e135da45418cf2c4579e6ff400e46 to your computer and use it in GitHub Desktop.
find all urls which doesn't have 2xx statuscode
#!/bin/bash
while IFS='' read -r line || [[ -n "$line" ]]; do
statusCode=$(curl -s -o /dev/null -I -w "%{http_code}" $line)
if [[ "$statusCode" != 2* ]]; then
echo "${statusCode},${line}"
fi
done < "$1"
# Usage: bash find_bad_urls.sh urls.txt >> failedurls.csv
@yatishbalaji
Copy link
Author

bash find_bad_urls.sh urls.txt >> failedurls.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment