Check URLs in .xml file for 404s

raw

code.sh

1
2
3
4
5
6
7
8
#!/bin/sh
# URLs are values of the tags "lthumb" and "photo"
# If they have a non-200 status code they will be printed out
xmlstarlet sel -t -v '//lthumb|//photo' file.xml\
    | grep -v '^$'\
    | xargs -L1 curl -I --silent --output /dev/null -w '%{http_code} %{url_effective}\n'\
    | grep -v ^200
 
Christian Weiske Christian Weiske
owner

History