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