EDirect is NCBI's command line entrez retrieval tool. It is used to retrieve data from a variety of NCBI databases, including literature mining from PubMed database.
Insiders Guide to Accessing NLM Data: EDirect Overview
Run the code
$ cd ~
/bin/bash
perl -MNet::FTP -e \
'$ftp = new Net::FTP("ftp.ncbi.nlm.nih.gov", Passive => 1);
$ftp->login; $ftp->binary;
$ftp->get("/entrez/entrezdirect/edirect.tar.gz");'
gunzip -c edirect.tar.gz | tar xf -
rm edirect.tar.gz
builtin exit
export PATH=${PATH}:$HOME/edirect >& /dev/null || setenv PATH "${PATH}:$HOME/edirect"
./edirect/setup.sh
Hit Enter
when you find your cursor blinking on the command
$ ./edirect/setup.sh
Run the command
$ echo "export PATH=\$PATH:\$HOME/edirect" >> $HOME/.bash_profile
$ esearch -version
This should display the most recent version of the tool.
$ esearch -db pubmed -query "Open AND Science[Title]" -datetype PDAT -mindate 2010 -maxdate 2018 | \
efetch -format xml | \
xtract -pattern PubmedArticle -element MedlineCitation/PMID > pmids.txt
This retrieves the PubMed ID of articles titled "Open Science" from PubMed published between 2010 and 2018 into a 'pmids.txt' file.
Entrez Direct: E-utilities on the UNIX Command Line
Github: NCBI-Hackathons/EDirectCookbook