base='http://www.wis-jma.go.jp/meta/oaiprovider.jsp?verb=GetRecord&metadataPrefix=iso19139' while read uri do cname=`echo $uri | sed 's/_/\t/g; s/:/_./g; s/[^-_0-9A-Za-z.\t]/_X/g; s/\t/__/g; '` if test ! -f ${cname}.oai then wget -O${cname}.oai "${base}&identifier=${uri}" fi if test ! -f ${cname}.xml && test -f ${cname}.oai then if test 0 -lt `xmllint --xpath \ 'count(//*[local-name()="metadata"]/*)' ${cname}.oai` then xmllint --xpath '//*[local-name()="metadata"]/*[1]' ${cname}.oai \ > ${cname}.xml else echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ echo @@@ #{cname} @@@ echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ fi fi done < ylist.txt