#!/bin/sh

# get lating words and print them sorted one per line without duplication

# In tex files I have \lis{num}{latin}{ipa}{translation}, e.g.
# \lis{1}{Stabat Mater dolorosa,}
#    {\textprimstress sta-bat \textprimstress ma-tEr do-lo-\textprimstress rO-za}
#    {Smärtfylld, i tårar}\\

# this script assumes \lis and the latin text is on the same line

fgrep '\lis' "$@" |
cut -f3 -d\{ |
sed -e 's/}//' |
tr -d '[:punct:]' |
tr ' ' '\n' |
tr '[:upper:]' '[:lower:]' |
sort -u
