#!/bin/bash BIBFILE=references.bib AUXFILE=report.aux PAGER=less TEMPAUX=$(mktemp) TEMPBIB=$(mktemp) echo "AUX: $AUXFILE => $TEMPAUX" egrep '^\\citation' $AUXFILE|sort|uniq|perl -ne 's#\\citation{(.*)}#$1#; print;' > $TEMPAUX echo "BIB: $BIBFILE => $TEMPBIB" egrep '^@' $BIBFILE|sort|uniq|perl -ne 's#\@\S+\s*{\s*(\S+)\s*,#$1#; print;' > $TEMPBIB echo "Comparing AUX with BIB (bib on the right). Using $PAGER pager." echo "Press ENTER when ready." read diff -y $TEMPAUX $TEMPBIB | $PAGER