The instruction
dbview filename attr attr* stringgenerates a prettyprint of the attributes attr attr* with their values for an entry matching the key string in file filename.
Example:
dbview sfb.lex Orth A3 B1 C1 D1 Sechskantschraube Entry 495: Sechskantschraube Orth: Sechskantschraube A3: zEks|kant|SraU|b@ B1: nomen,akk,fem,sg,@empty@,@empty@,Scchskanntchraube,@empty@ nomen,nom,fem,sg,@empty@,@empty@,Sechskantschraube,@empty@ C1: Nom,OBJEKTTYP D1: nom
#!/bin/sh
# dbview
# 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]
file = ARGV[1]
errors = ARGV[1]".errors"}
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 ":", keyword
{for (i=1 ; i <= NF ; i++)
if (attrib[i] ~ "yes") {print " " attname[i] ":\t" $i
found="yes"}}}
{last=NR}
END {if (found!="yes") {print keyword,"not found in",file 2>> errors}}
' $* |
# |
sed -e "s/;;/\//g
s/;/& /g" |
tr ";" "\012"