Created
July 4, 2012 09:55
-
-
Save editnuki/3046459 to your computer and use it in GitHub Desktop.
リンク集のHTMLを取得してリンク切れかどうか検証するスクリプト
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 | |
DIR="/home/user/shell/link" | |
WGET=`wget -q http://sample/sample.html -O $DIR/link.html` | |
CHARSET=`nkf -w8 $DIR/link.html > $DIR/link.txt` | |
URLHTML=`cat link.txt | grep HREF |grep -v font |sed 's/<A HREF\=\"//g' |sed 's/\" TARGET\=\"\_blank\">/ /g' | sed 's/<\/A><br>//g'| sed 's/<\/A><BR>//g' |awk '{print $1}' |grep http ` | |
for URL in $URLHTML;do | |
wget -q -O /dev/null $URL | |
FLAG=`echo $?` | |
if [ $FLAG -eq 0 ];then | |
echo "$URL is OK" | |
else | |
echo "$URL is link error" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment