#! /bin/bash
#
# google extract
# ingo@cimdata.de
#

if [ $# -ne 1 ] ; then
   echo "Usage: filewithurl2extract"
   exit 1
fi

echo "Extratcing google search results from file: $1"

# not runnig 
#LIST=`echo -en "GET /scripts/search/search.asp?qu=bike++office HTTP/1.0\n\n"| netcat 7search.com 80` # |grep "\[*\]"|cut -f 2 -d [|cut -f 1 -d ]`

# in LIST are now the urls 
LIST=`grep "\[*\]" $1|cut -f 2 -d [|cut -f 1 -d ]|grep http`

#debug
echo $LIST

# for evry entry in LIST we execute wget
for word in $LIST ; do
   wget -r -k -l 2 -nc $word
done

exit 0
