lookup.awk
lib/lookup.awk · 582 B
From the archive Copper2-lib.tar.gz
Download the archive « Back to the archive contents
#
# Searchs input file for the "target" object
# Prints object number and line matching "target"
# Assumes the object/mob file format is :
# <#number>
# <short_desc>
# <slightly longer desc> <-- we save this one.
#
# ie. #6902
# staff~
# Dionysos' staff of Wonders~
#
# Invocation : gawk -f lookup.gawk target=<value> <input file> > output file
#
# nawk can be used for gawk.
#
BEGIN { IGNORECASE = 1 }
/#[0-9]+/ { prev = $0
getline
getline
if ($0 ~ target) {
printf "%s %s\n", prev, $0;
}
}
{}