#!/bin/bash entries () { grep -Po "(newglossaryentry|new(abbreviation|acronym)(\[.*\])?)\{[A-Z0-9]+" "$1" | grep -Po "[A-Z0-9]+$" } # find number of occurances entries preamble/glossaries.tex | xargs -I'<>' bash -c 'echo -n "<> " && grep -ni --color=always "{<>}" {appx,front,back,intro,concl,top,tvt,dsl}/*.tex | wc -l' | sort -nk2 # find uses without \gls*{} #entries preamble/glossaries.tex | xargs -I'<>' grep -nPi --color=always "[ ]<>[. $]" {appx,front,back,intro,concl,top}/*.tex