10.0;exfld (extract_fields), revision 1.0, 88/01/21
exfld (extract_fields) -- Manipulate fields of data.
usage: exfld {field-list | -t [c]} output_format [pathname ...]
DESCRIPTION
exfld manipulates data kept in formatted fields. It copies data from
specified fields of the input files to specified places in standard
output.
ARGUMENTS
field_spec (required)
Specify either a field list or a free-format separator as
follows:
field_list
Integer list identifying fields in the input file to be copied.
Up to 9 input fields are allowed. You can specify a field by
the columns in which it occurs or by its starting column and
length. For example, 5-10 denotes a field that extends from
column 5 through column 10, and 3+2 denotes a field that starts
in column 3 and spans 2 columns. When specifying more than one
field, separate the specifications with commas, for example,
5-10,16,72+8
Fields can overlap, and need not be in ascending numerical
order. Thus
1-25,10,3
is a valid field specification.
-t [c] Free-format separator specification. If input fields do not
fall in certain columns, but rather are separated by some
character (such as a blank or a comma), describe the fields by
using -t c, replacing c with the appropriate separator. A tab
character is the default for c.
output_format (required)
Specify literal string representing output format. Fields from
input are referred to as $n (for example, $1, $2, $3, and so
forth) denoting the order the fields are specified in. Up to 9
fields are allowed, plus the argument $0 which refers to the
whole line. Place the $n symbol in the output format wherever
the corresponding field should appear, surrounded by any
characters desired. For example, an output format specification
of
"$2 somewords $1"
produces an output line such as
field2 somewords field1
pathname (optional)
Specify input file to be manipulated.
Default if omitted: read standard input
EXAMPLES
Specify extraction and input text from standard input.
$ exfld 1-5,14-18 "$2 follows $1"
ABCDE is not DEFGH
DEFGH follows ABCDE
*** EOF ***
$