#!/usr/bin/awk -f # dirty xml reading is more fun # requires nawk / gawk for sub() BEGIN { FS = "" } { printdefs($1, $2); } function printdefs(word, defs) { # split the headwords and other information about the word, # to be used in conjuction with dictfmt's --index-data-separator sub("", " ", word); n = split(defs, array, ""); for(i=0; i<=n; i++) { if(array[i] != "") { printf(":%s: %s\n", word, array[i]); } } }