09-18-2007
11,
0
Join Date: Sep 2007
Last Activity: 13 October 2012, 8:18 AM EDT
Posts: 11
Thanks Given: 0
Thanked 0 Times in 0 Posts
using Lynx and Grep to return search page rank - help
I am writing a script which will read in search terms from a text file and pass each line to Lynx. Lynx will grab the source html, then I want grep/tr, whatever to search for the first occurance of a term (mydomain.name), then delete from that 1st occurance on, creating a new end of file.
Then I want to count a certain marker <class=L> in the remaining source to determine the search engine page rank until end of file.
This is what I have so far. My primary issue is that google returns all search html source as 1 line, which is why I need to count the style tag <class=L> (in this case lowercase L), what I have right now grab the search terms and the results, but I'm unsure of where to go from here.
#!/bin/bash
cat ${1} | while read searchTerm; do
#echo "${searchTerm}"
lynx -source -accept_all_cookies "http://www.google.com/search?q=$searchTerm">> /path/to/dir/archive.txt
done
Thanks in Advance!