# /u/sy/beebe/tex/bib/find-duplicate-pages.awk, Sun Oct 17 17:01:42 1999 # Edit by Nelson H. F. Beebe # ======================================================================== # Find successive BibTeX Article or InProceedings entries that have # identical starting page numbers. # # Usage: # gawk -f find-duplicate-pages.awk # # [17-Oct-1999] # ======================================================================== BEGIN {} /^@(Article|InProceedings)/ { new_entry($0) } /^ *pages *= / { First_Page = first_page(get_value($0)) if (First_Page == Previous_First_Page) warning("duplicate first pages in " Current_Label " and " Previous_Label) next } END {} function first_page(pages, parts) { split(pages,parts,"-+") return (parts[1]) } function get_value(line, s) { s = substr(line,index(line,"\"")+1) sub(/\"?,?$/,"",s) # print "DEBUG: v = [" s "]" return (s) } function new_entry(s) { Previous_First_Page = First_Page Previous_Label = Current_Label Current_Label = s sub("^.*{ *","",Current_Label) sub(" *,.*$","",Current_Label) } function warning(message) { print FILENAME ":" FNR ":%%:" message }