gravatar for nattzy94

2 hours ago by

I am trying to automate routine pubmed searches for daily use. My goal is for the program to output the publications present on pubmed for that day e.g. to get all publications from Nature on 8 Mar 2020.

So far I have the following:

cd /Users/nattzy/Documents/journal_articles
mkdir "$(date +"%Y-%m-%d")"

journals=('nature' 'nature communications' 'lancet')

for i in "${journals[@]}"
do
  :
  date=$(date +"%Y/%m/%d")[EDAT]
  query=""$i[jour] AND $date""
  echo "$query"
  esearch -db pubmed -query "$query" | efetch -format abstract > ./$(date +"%Y-%m-%d")/"$i".txt
done

When I run the script, all I get are empty text files. However, if I input the same search query manually on the pubmed website, I will get results. For example, today's search for Lancet articles: Lancet[JOUR] AND 2020/3/8[EDAT] gives me 6 results.

Would be great if someone could help with my script. Or suggest if there is another way to achieve the same goal.
Thank you!

link

modified 2 hours ago

written
2 hours ago
by

nattzy9420



Source link