Skip to content

Instantly share code, notes, and snippets.

@ShigekiKarita
Last active September 2, 2015 06:07
Show Gist options
  • Save ShigekiKarita/f815a05062915fb733a6 to your computer and use it in GitHub Desktop.
Save ShigekiKarita/f815a05062915fb733a6 to your computer and use it in GitHub Desktop.
Script to copy PDFs described in Mendeley's bibtex
#!/usr/bin/env zsh
function usage {
cat <<EOF
Note:
cp_bibpdf copys PDFs described in Mendeley's bibtex
Usage:
cp_bibpdf {src.bib} {dst_dir}
EOF
}
if [ $# -ne 2 ]; then
usage
exit 1
fi
files=`grep -e "pdf" $1 \
| sed 's/^file = {://g' \
| sed 's/:pdf},//g' \
| sed 's/\(.*\)/\/\1/g'`
while read -r line; do
echo "$line"
cp $line $2
done <<< "$files"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment