gffmatch - Find matching items from the gff structures
gffmatch [--help|-h] [--version|-V] [--verbose|-v]
[--config config-file]
[--print-filename]
[--print-basename|-b]
[--print-fields-recursive]
[--exclude|-e exclude-regexp]
[--include|-i include-regexp]
[--find-struct|-s structure-regexp]
[--print-fields|-p fields-to-print-regexp]
[--proc struct
|full
|field
|value
|path
|label
|csv
]
--find|-f label-regexp:=:
value-regexp
[--find|-f label-regexp:=:
value-regexp ...]
[--find|-f label-regexp:!:
value-regexp ...]
[--or|-o --find|-f label-regexp:=:
value-regexp ...]
[--parameter|-P name=
relative-path]
[--global-parameter|-g name=
absolute-path]
[--area-parameter|-a name=
absolute-path]
[--variable-parameter name=
varname]
[--variable-parameter name=
/globalvarname]
[--variable-parameter name=
..parentvarname]
[--dialog|-d filename.tlk]
filename ...
gffmatch --help
gffmatch first finds the structure specified with the -s option (or use root if it is not set). Then it starts matching the list of -f options in the order of all of them match then it will print out requested information. All -f options are anded together, and multiple set of -f options can be given separated with -o which are then ored together (i.e. if any of the sets ored together matches then print out information).
Information printed out is specified with the -p option, which gives the regexp of items from the matched structure which are printed out. If --print-fields-recursive is given then those fields are printed out completely.
If information needs to be printed out from different parts of the
tree, then named parameters can be used to do that. Named parameters
are created by using --parameter, --global-parameter,
--area-parameter or --variable-parameter. Each of those options
takes a name of the parameter and the path to use when getting the
parameter value. The --parameter takes the parameters from the
given structure, i.e. the path is relative to the current matched
structure. The --global-parameter takes the parameters from the
toplevel structure, and --area-parameter takes them from the area
file instead of this git file (it is useful when getting for example
Name or Tag of the area). As area name and tag are so commonly used
there is always automatic paramters @areaname@
and @areatag@
which are set to match the area name and tag.
The --variable-parameter takes the parameter value from the
variables. It can take 3 different types of input. If the varname
is simply normal variable then it is taken from the current structure.
If it is /
varname then it is taken from the toplevel structure,
and if it is ..
varname then it is is taken from the matching
structure, and if not set there then from the parent structure etc.
^/Creature List\\[\\d+\\]/\$
.
@
name@
it is replaced with the named
paramter name. For areas there is automatic parameters named
@areaname@
, and @areatag@
. For all items there is always the
@path@
. Those items can appear anywhere on the regexp and if they
are there, the values of them are printed out. So use them inside the
regexp like this: Name|Tag|@areaname@
.
struct
|full
|field
|value
|path
|label
|csv
struct
full
field
value
path
label
csv
:=:
value-regexp>:!:
value-regexp>=
relative-path@name@
.
It can also be used when modifying field or setting variables. It
cannot be used when matching the structure.
=
absolute-path@name@
. It can also
be used when modifying field or setting variables. It cannot be used
when matching the structure.
=
absolute-path@name@
. It can also be used when modifying field or
setting variables. It cannot be used when matching the structure.
=
varname/
then then variable read from the top structure. If
it starts with ..
then the variable is read first from mathing
structure, and if not found there, the parent structure, etc until it
is read from the top structure. In other cases the variable is read
directly from the matching structure.
This name can then be used in the -p structure in format
@name@
. It can also be used when modifying field or setting
variables. It cannot be used when matching the structure.
The named parameter can also do simple expressions. I.e. instead of
only @name@ they can have
@random(12)@
or similar functions
which are replaced with the output of the given function.
Supported functions are:
gffmatch.pl --include Creature \ --find-struct '^/Creature List\[\d+\]/$' \ --find '/Plot:=:^1$' \ --print-fields '/Creature List\[\d+\]/Tag$' \ *.git gffmatch.pl \ -s '^/List\[\d+\]/$' \ -p 'LocalizedName' \ -f 'Plot$:=:.*' \ *.git gffmatch.pl \ -s '^/Creature List\[\d+\]/$' \ -p 'FirstName|LastName|Tag' \ -f '/Conversation$:=:^$' \ *.git gffmatch.pl \ -s '^/[a-zA-Z0-9 ]+\[\d+\]/$' \ -p 'Tag|CloseLockDC|Locked|Lockable|OpenLockDC|KeyName' \ --proc full \ -f "/OpenLockDC$:=:^([6789][0-9]|...)$" \ -f "/KeyRequired$:=:^0$" \ -f "/Locked$:=:^1$" \ -o \ -f "/OpenLockDC$:=:^([6789][0-9]|...)$" \ -f "/KeyRequired$:=:^0$" \ -f "/Locked$:=:^0$" \ -f "/Lockable$:=:^1$" \ *.git gffmatch.pl \ --proc csv \ -b \ -s '^/Creature List\[\d+\]/$' \ -p 'ScriptSpawn,Tag,TemplateResRef,FirstName,LastName' \ -f '/ScriptSpawn$:=:.' \ *.git > list.csv gffmatch.pl \ --proc csv \ -b \ -s '^/$' \ -p 'ScriptSpawn,Tag,TemplateResRef,FirstName,LastName' \ -f '/ScriptSpawn$:=:.' \ *.utc >> list.csv
gffencode(1), gffmodify(1), gffprint(1), Gff(3), and GffRead(3).
Tero Kivinen <kivinen@iki.fi>.
This program evolved later to gffmodify(1), and because of that
gffmodify(1)
knows even more tricks than this program.