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
#!/bin/bash | |
#This script searches the Downloads folder for NBER working papers (PDFs starting with "w2") and renames them in "Author - Title (NBER Year)"" format. | |
cd ~/Downloads | |
papers=$(find . -name "w2[0-9]*.pdf" | sed 's/^.\//\ /' | sed 's/.pdf//' | tr -d '\n') | |
echo "$papers" | |
for wp in $papers | |
do | |
curl https://www.nber.org/papers/$wp.ris > temp.txt | |
grep 'AU' temp.txt | awk -F- '{print $2}' | awk -F, '{printf $1 ","}' > temp2.txt |