A Bash script
#!/bin/bash # Jovanovic, 2011-12 / 2012-11, looking up words in local CroALa Philo # usage: ./localcaula-pl.sh # read arguments from command line, send to caula (local CroALa) # process results, save in $$-rezultati, $$-rezultati.csv # variable for author search: autor="&author=panonij" # variable for filename to store results: rezultati="`echo $$`-rezultati" while read item do curl --globoff "http://localhost/cgi-bin/philo/search3t?dbname=caula&word=${item}${autor}&OUTPUT=TF" \ | egrep -i "Your search found|Nothing found matching|for <b" - \ | sed 's/.*for <b>\([^<]*\)<.*/\1 =/g' \ | sed 's/.*Your \(search found.*occurrences\).*/\1;/g' \ | sed 's/.*\(Nothing found matching\).*/\1;/g' \ - >> ${rezultati} # write results to file done # report name of file: echo "Rezultati u: ${rezultati}, adio." # clear up the results list: perl -0777 -wpl -e "s/\nsearch//g;" ${rezultati} \ | perl -0777 -wpl -e "s/\nNothing found matching;/ 0/g;" \ | sed 's/^\(.*\) = *\([^0-9]*\)\([0-9]*\).*/"\1","\3"/g' > ${rezultati}.csv # report name of CSV file: echo "CSV u: ${rezultati}.csv, adio." # end of script