Last active
September 2, 2015 06:07
-
-
Save ShigekiKarita/f815a05062915fb733a6 to your computer and use it in GitHub Desktop.
Script to copy PDFs described in Mendeley's bibtex
This file contains hidden or 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
#!/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