[Shell] lynx¸¦ ÅëÇÑ ³»ºÎ ¸µÅ©¿Í ¿ÜºÎ ¸µÅ© return
|
|
ÀÛ¼ºÀÚ :
rootman
Date : 2008-03-14 10:06 | Hit : 9,464
|
[[email protected] ~/bin]# cat -n UrlReturn.sh
1 #!/bin/sh
2 # DATE : 2008/03/12
3 # Writer : JeongChanHo([email protected])
4 # http://www.rootman.co.kr 5 # FileName : UrlReturn.sh
6 echo "-------------------------------------";
7
8 if [ $# -eq 0 ]; 9 then
10 echo "Usage: $0 [-d|-i|-x\\ url" >&2
11 echo "-d=domains only, -i=internal refs only, -x=external only" >&2
12 exit 1
13 fi
14
15 if [ $# -gt 1 ]; 16 then
17 case "$1" in
18 -d) 19 lastcmd="cut -d/ -f3 | sort | uniq";
20 shift
21 ;;
22 -i)
23 basedomain="http://$(echo $2 | cut -d/ -f3)/";
24 lastcmd="grep \\"^$$basedmain\\" | sed \\"s|$basedomain||g\\" | sort | uniq"
25 shift
26 ;;
27 -x)
28 basedomain="http://$(echo $2 | cut -d/ -f3)/"
29 lastcmd="grep \\"^$basedmain\\" | sort | uniq"
30 shift
31 ;;
32 *)
33 echo "$0: unknown option specified: $1" > $2; exit 1
34 esac
35 else 36 lastcmd="grep -v "javascript" | sort | uniq"
37 fi
38
39 # ¢¯©ª¨¬¡í
40 lynx -dump $1 | sed -n '/^References$/,$p' | grep -E '[[:digit:]]+\\.' | awk '{print $2}' | cut -d\\? -f1 | eval $lastcmd
41
42 #lynx -dump $1 | sed -n '/^References$/,$p' | grep -E '[[:digit:]]+\\.' | awk '{print $2}' | eval $lastcmd
43 exit 0;
44
[[email protected] ttt]# sh UrlReturn.sh -d http://www.rootman.co.kr -------------------------------------
eventkr.englishtown.com
www.rootman.co.kr
|
|
|