READINFO(1) 06:53:22 READINFO(1)
NAME
readinfo - read fields from a relational
SYNOPSIS
readinfo [ -a ] [ -i filename ] [ -o filename ] [ -L ] fieldname ...
DESCRIPTION
Reads a formatted table in a relational format with named fields.
Input is from stdin unless the -i is specified. Output is to stdout
unless the -o option is specified. The -a option specifies output
should be appended to the output file instead of overwriting the output
file. The -L option specifies line numbers shoudl be prepended to each
output line.
The file is described by a special comment or meta command which
defines the field names and any prefixes or suffixes to add to each
field. The following is a simple example which illustrates the usage.
#
# short readinfo example
#FIELDS GLOBAL null=X no=. domain suffix=.tic.com ip prefix=192.135.128.
akasha 129
xfr 133
oak.zilker.net. .198.252.182.129
The special #FIELDS comment (can also be specified as $FIELDS)
describes each field in the file. Field descriptions appear in the
order the appear in the file. There is no whitespace between the #
and the FIELDS. FIELDS must be all uppercase.
In this example two fields with the names "domain" and "ip" are
defined. The special field "GLOBAL" defines global parameters which
apply to all fields in the file. Each field description is the name of
the field which can be any arbitrary name followed by optional field
parameters which are keyword=value pairs. The field parameters and
their semantics are:
null=
Sets the empty field value to the . Whenever
appears as a field value, readinfo emits an empty value for the
field.
prefix=
Adds a prefix of to each field value output.
suffix=
Adds a suffix of to each field value output.
no=
Does not add a prefix or suffix to the field value whenever
either starts or ends the string respectively.
Only fields listed on the command line are output to stdout. For exam
ple the command
readinfo domain ip ,,
#END
Generators may not be nested in the current implementation. Whenever
appears within curly brackets within the GENERATO construct, it is
replaced with the current loop value.
An example of a GENERATOR is:
#FIELDS host suffix=.tic.com ip prefix=192.168.128.
#GENERATOR num 97,102,1
dhcp-{num} {num}
#END
THis produces the output:
dhcp-97.tic.com 192.168.128.97
dhcp-98.tic.com 192.168.128.98
dhcp-99.tic.com 192.168.128.99
dhcp-100.tic.com 192.168.128.100
dhcp-101.tic.com 192.168.128.101
dhcp-102.tic.com 192.168.128.102
casa-pc.tic.com 192.168.128.254
4th Berkeley Distribution $Date: READINFO(1)
|