#WBL 20 May 2011 $Revision: 1.6 $ #Many entries provided by IEEE xplor for matching "genetic programming" #only match the string but have little to do with GP. #this gawk script insists GP or related string is included in metadata #WBL 17 Apr 2022 add last for Una-May #WBL 31 Oct 2021 bugfix year = {} etc. now treated as year missing #WBL 18 Mar 2021 based on select_gp.awk r1.6 #WBL 14 Sep 2020 bugfix exclude ieee keywords, based on add_key_xplor.awk r1.3 #WBL 31 May 2013 exclude ieee keywords! #WBL 27 May 2011 Also match genetic-programming etc and GNP #example: #gawk -f select_year.awk -v "last=1993" gp-bibliography.bib #gawk -f select_year.awk -v "first=2015" gp-bibliography.bib BEGIN{ } (FNR==1) { printf("%%select_year.awk %s last=%s first=%s %s %s\n", substr("$Revision: 1.6 $",2),last,first,FILENAME,strftime("%d %b %Y")); } (index($0,"@")==1){ if(ok()) print entry; year = entry = ""; } (year=="" && index(tolower($1),"year")==1 && (s=index($0,"="))) { ; u = substr($0,s+1); u2= gensub(/[ \t\"\{\},]+/,"","g",u); #print FNR,$0,"`"u"'","`"u2"'"; year=(u2!="")? 0+u2 : ""; #print u2,year; if(0+year<=1900 || 0+year>=3000) { print "ERROR year=`"year"' line"FNR,FILENAME > "/dev/stderr"; print $0 > "/dev/stderr"; exit 1; } } (1){ entry = (entry=="")? $0 : sprintf("%s\n%s",entry,$0); } END{ if(ok()) print entry; } function ok(){ #assume no year means in the future #if(last!="") print "year",year "last=",last; if(last!="") return (year==0 || year=="")? 0 : year <= last; return (year=="")? 1 : year >= first; }