Skip to content

Instantly share code, notes, and snippets.

@jmbr
Created March 9, 2022 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmbr/67c8458dbc2ee6bbd747fad81c8deb0a to your computer and use it in GitHub Desktop.
Save jmbr/67c8458dbc2ee6bbd747fad81c8deb0a to your computer and use it in GitHub Desktop.
Find BibTeX entries that are not referenced from the TeX document files.
#!/bin/sh
if [ $# -ge 1 ]; then
bibtex_file=$1
else
bibtex_file="bibliography.bib"
fi
awk -F "[{,]" '/^@/ { print $2 }' $bibtex_file \
| while read reference; do
grep --quiet --no-messages --max-count=1 --fixed-strings "$reference" *.tex
if [ $? -eq 1 ]; then
echo $reference;
fi;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment