Created
February 20, 2015 15:21
-
-
Save petrelharp/c93be8937267393f5603 to your computer and use it in GitHub Desktop.
download all publications from bibsonomy as bibtex (even if there are more than 1000 of them)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
URL="http://www.bibsonomy.org/bib/user/peter.ralph?items=1000&bibtex.start=" | |
OUTFILE="peter.ralph-bibsonomy-$(date '+%Y-%m-%d').bib" | |
TEMPFILE=$(mktemp "get-bib.tmpXXXX") | |
if [ -e $OUTFILE ] | |
then | |
echo "$OUTFILE already exists. Delete it first." | |
exit 1 | |
fi | |
for START in 0 $(seq 10) | |
do | |
echo "----------------------------------" | |
echo "Getting $(($START+1))-th thousand." | |
echo "----------------------------------" | |
wget "${URL}${START}000" -O $TEMPFILE | |
cat $TEMPFILE >> $OUTFILE | |
if [ ! -s $TEMPFILE ] | |
then | |
break | |
fi | |
done | |
echo "Done with ${OUTFILE}." | |
rm $TEMPFILE | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment