#!/bin/csh
# This script reads chemical names from the file in it's argument list,
# requests information on these chemicals from webbook.nist.gov using lynx,
# and saves the results to the second name it it's argument.
# E.g. use getcheminfo2 infile outfile

set tmp = tmpOKtoDelete
echo Chemical CAS\# > $2
foreach chemical (`cat $1`)
  echo Looking up $chemical
  lynx -source "http://webbook.nist.gov/cgi/cbook.cgi?Name=$chemical&Units=SI" > $tmp
  set CAS = `cat $tmp | grep Registry`
  echo $chemical $CAS >> $2
end
rm $tmp
