Skip to content

Instantly share code, notes, and snippets.

@petrelharp
Created February 20, 2015 15:21
Show Gist options
  • Save petrelharp/c93be8937267393f5603 to your computer and use it in GitHub Desktop.
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)
#!/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