/ Published in: Bash
get urls from bookmarks, run wget against the list of urls, then parse the log looking for bad return codes
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
grep '\"url\":' Bookmarks | awk '{ print $2}' | sed 's/"$//' | sed 's/^"//' > linkchecks # creates the list of urls to check wget --server-response --spider -o log_file2_wget -ilinkchecks # check the links for validity and produce log with return code values gawk '{ /^--/ {VAR=$3}; /^..HTTP/ {print VAR" "$2" "$3}; /timed.out.$/ {print VAR" "$2" "$3} }' log_file2_wget > log_http_rc OUTPUT: http://www.macromedia.com/special/forums_down.html?forumid=15 301 Moved http://www.adobe.com/special/forums_down.html?forumid=15 200 OK http://www.outpost.com/peripherals/ 301 Moved http://frys.com/peripherals/ 404 Not http://4808.runbox.com/docs/en/help/manager/access/pop/default.doc 302 Moved