consump/bin/abbr.sh

17 lines
328 B
Bash
Executable File

#!/bin/zsh
awk '
{
if (FILENAME == "db/abbreviations.txt") {
split($0, fields, ":")
abbr[fields[1]] = fields[2]
next
}
for (a in abbr) {
for (i = 1; i <= NF; i++)
if (tolower($i) == tolower(a)) {
$i = "<abbr title=\""abbr[a]"\">"$i"</abbr>"
}
}
print $0
}' db/abbreviations.txt $*