#/usr/bin/bash
if [ $# -ne 3 ]
then
echo "Get #N protein sequences for QUERY_TERM from the past number of DAYS"
echo "No arguments supplied / Usage: QUERY_TERM DAYS MAX_ENTRIES"
fi
wget -qO- "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?rettype=uilist&retmode=xml&datetype=pdat&reldate=$2&db=protein&field=title&term=$1&retstart=0&retmax=$3" |
egrep -o '(.*|[0-9]+)' |
sed 's/<[/A-Za-z]\+>//g' |
head -n -2 |
awk -v ret=$3 '{
if($0 == 0){print "No hit in titles"; exit}
else{print "Only the first "ret" Sequences are shown"};
if(ret > $0){ret=$0; print "There are less hits than requested!"} # corrected 161013
print "Hits for Query Term: "$0;
for(i=0; i