# # KEHOME/bin/GetLetter # Oct/30/2003 # usage: GetLetter author recipient # inputs: # author # recipient # $site/opinion # outputs: # opinion.out # email # gather online info. # from Fresno Bee # Letters to the Editor # find letter_number has author="$Author" # and notify "$Recipient" # see bottom of this script # Examples # GetLetter "John Doe" 5551234567@mobile.att.net # GetLetter "John Doe" jdoe@yahoo.com #echo "# GetLetter $@" #alias echo="print -r" #alias wget=":" #alias ke=":" if [ -n "$1" ] then Author="$1" else echo "Usage: GetLetter author recipient" >&1; exit fi if [ -n "$2" ] then Recipient="$2" else echo "Usage: GetLetter author recipient" >&1; exit fi site=http://www.fresnobee.com echo "set site = $site;" >opinion.ku wget -O opinion.html "$site/opinion/v-print" htmlone < opinion.html | grep -n lets_ed >lets_ed.html cat lets_ed.html | sed 's/:.*$//' >lets_ed.number cat lets_ed.html | sed 's/^.*href=//' | sed 's/ .*$//' >lets_ed.url cat lets_ed.html | sed 's/^.*>//' | sed 's/ $//' >lets_ed.title paste.exe -d',' lets_ed.number lets_ed.title lets_ed.url >lets_ed.rel while read line ; do # line ::= number,title,url number=$(echo "$line" | cut -d',' -f1) letter=letter_$number title=$(echo "$line" | cut -d',' -f2) url="$site"/$(echo "$line" | cut -d',' -f3) echo "$letter has title=\"$title\";" >>opinion.ku echo "$letter has url=\"$url\";" >>opinion.ku echo "# INFO: wget $letter.html from $url;" >>opinion.ku wget -O $letter.html "$url" echo "do ExtractData od $letter from $letter.html done;" >>opinion.ku done <lets_ed.rel echo "person isc* ?;" >>opinion.ku echo "exit;" >>opinion.ku set -x ke opinion.ku grep "has author" opinion.out if msg=$(grep "has author" opinion.out | grep "$Author") then rebol -iqsw --do "send $Recipient {found $msg}" else rebol -iqsw --do "send $Recipient {$Author letter not found}" fi #