Google Search Script
From: Alan Connor (zzzzzz_at_xxx.yyy)
Date: 12/31/04
- Next message: John W. Krahn: "Re: sed/perl/awk increment a pattern"
- Previous message: Chris F.A. Johnson: "Re: Search for best matched portion of a string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 31 Dec 2004 09:36:55 GMT
Here's a script I use myself that makes google searches really
quick.
-----------------------------------------------------------
#!/bin/sh
#googsearch.sh copywrong Alan Connor 2004
# The script uses wget to fetch the first 100 google hits and
# converts them to text using $_CONVERTCOMMAND and opening the
# in your chosen editor. You put XX in front of and touching the
# URLS of any sites you want to take a closer look at:
#
# XXwww.somewhere.com/greatpage.html
# (All the urls you want to select need to start with XXwww.)
#
# The index pages of each URL you choose is brought down and all
# of them are concatenated in a single webpage, each one preceded
# by the headers returned by the server that it was on (so that
# you can tell where one begins and another leaves off).
#
# At the bottom of the page are links to the webpages you chose
# so that you can go directly to them for on-line viewing.
#
# Run in an xterm if you want to use a graphical browser.
#
# See this page for how to create good google search strings:
# http://www.google.com/help/refinesearch.html
# textmode browser for the first, fast part
_TBROWSER=/usr/bin/w3m
# graphical browser for checking out the site on-line
# I prefer textmode for almost everything so...
_GBROWSER=/usr/bin/w3m
_EDITOR=/usr/bin/nvi
_SAVEDIR=$HOME
_SEARCHRESULTS=${_SAVEDIR}/searchresults.html
_URLFILE=${_SAVEDIR}/googurls
_SEARCHFILE=${_SAVEDIR}/goog.txt
# change this if you are using a different browser or
# utility to convert html to text
_CONVERTCOMMAND="w3m -dump -T text/html"
clear
echo; echo; echo;
if [ -s $_SEARCHFILE ] ; then less $_SEARCHFILE ; else
echo
echo
echo "Ctrl-c to exit"
echo
echo
echo "enter your google search string here:"
echo; echo
read ss
echo
echo
echo
wget -U msie -O - "http://www.google.com/search?&q=${ss}\
&num=100&hl=en" | eval ${_CONVERTCOMMAND} > \
$_SEARCHFILE
fi
$_EDITOR $_SEARCHFILE
sed -n '/XXwww/{;s/\(XX\)\([^ ]*\)\( .*\)/http:\/\/\2/p;}' \
$_SEARCHFILE >> $_URLFILE
wget -U msie -s -i $_URLFILE -O $_SEARCHRESULTS
echo >> $_SEARCHRESULTS
echo "<html><body><pre>" >> $_SEARCHRESULTS
echo >> $_SEARCHRESULTS
while read line; do echo "<p><a href=\"${line}\">${line}</a>" \
>> $_SEARCHRESULTS
done < $_URLFILE
echo >> $_SEARCHRESULTS
echo "</pre></body></html>" >> $_SEARCHRESULTS
echo >> $_SEARCHRESULTS
$_GBROWSER $_SEARCHRESULTS
clear
echo
echo "If you want to rm $_SEARCHRESULTS enter r - to mv enter m"
echo
read AA
echo
case "$AA" in
r) rm $_SEARCHRESULTS ;;
m) echo; echo "enter new name/path sans .html" ;echo ; read NM ; echo ;\
mv $_SEARCHRESULTS "${NM}".html ;;
*) echo "try again" ; sleep 2 ; return ;;
esac
rm $_SEARCHFILE $_URLFILE
exit 0
------------------------------------------------------------
AC
-- Pro-Active Spam Fighter Pass-list --> Block-list --> Challenge-Response http://tinyurl.com/2t5kp
- Next message: John W. Krahn: "Re: sed/perl/awk increment a pattern"
- Previous message: Chris F.A. Johnson: "Re: Search for best matched portion of a string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|