Files
bibd-test/urlconv.sh

19 lines
478 B
Bash
Raw Normal View History

2019-10-18 17:08:35 -07:00
#!/bin/bash
if [ "$1" == "-h" ] ; then
echo "
urlconv - add blob to ipfs and convert corresponding referring url in a bibtex database file
Usage: urlconv preprint.pdf references.bib
"
#echo "$(tput setaf 6)$EDITOR $(tput setaf 7)is currently set as editor"
exit 0
fi
fn=$1
bibFile=$2
relPath="ipfs://"
hashid=$(ipfs add $fn | grep $fn | cut --delimiter=" " -f 2)
sed -i -E "s|(\W*Url = \{).*$fn(\}.*)|\1$relPath$hashid\2|" $bibFile