Query all of CroALa with items from the list

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
 
z/croala-query-all-bash.txt · Last modified: 04. 11. 2012. 19:09 by njovanov
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki