The instruction
dbviewr filename attr attr* regexpgenerates a prettyprint of the attributes attr attr* with their values for an entry matching the key regular expression regexp in file filename
Example:
dbviewr sfb.lex Orth A3 B1 C1 D1 Mu.*r Entry 372: Mutter Orth: Mutter A3: mU!t6 B1: nomen,akk,fem,sg,@empty@,@empty@,Raute,@empty@ nomen,nom,fem,sg,@empty@,@empty@,Raute,@empty@ C1: Nom,OBJEKTTYP D1: nom Entry 373: Muttern Orth: Muttern A3: mU!t6n B1: nomen,akk,fem,pl,@empty@,@empty@,Raute,@empty@ nomen,nom,fem,pl,@empty@,@empty@,Raute,@empty@ C1: @empty@ D1: @empty@WARNING: The instruction dbviewr sfb.lex Orth A3 B1 C1 D1 .* prettyprints all entries in sfb.lex for attributes Orth A3 B1 C1 D1!
#!/bin/sh
# dbviewr
# D.Gibbon, 20.11.1994
# Revised 15.1.94 for SFB360
# Note: Watch for column numbers ...
# Prettyprint of single entries
# and attributes in lexicon database.
if [ $# -lt 3 ]
then
echo "Usage: dbview dbname attribute* word"
echo "dbview V2, 15.1.1994, D. Gibbon"
exit
fi
gawk '
BEGIN {keyword = ARGV[ARGC-1]}
NR == 1 {{for (i=2 ; i < ARGC ; i++)
{for (j=1 ; j <= NF ; j++)
if (ARGV[i] == $j) {attrib[j] = "yes"; attname[j] = $j}}}
{for (i = 2 ; i < ARGC ; i++)
ARGV[i]=""}}
$1 ~ keyword && NR > 2 {print "\nEntry " NR-1 ":", $1
{for (i=1 ; i <= NF ; i++)
if (attrib[i] ~ "yes") {print " " attname[i] ":\t" $i
found="yes"}}}
{last=NR}
END {if (found!="yes") {print "No entry found for",keyword,"in",ARGV[1]}}
' $* |
# |
sed -e "s/;;/\//g
s/;/& /g" |
tr ";" "\012"