(Video materials in preparation)
tagawk : A wrapper for awk that allows tag names to be used
Usage : tagawk '<PATTERN>{<ACTION>}' <file>
Version : Mon Aug 10 23:00:51 JST 2015
Edition : 1
The tagawk command allows you to use tag names (%TagName or %{TagName})
instead of field variables ($1, $2) in the awk script "<PATTERN>{<ACTION>}".
When the tagawk command detects a tag-name variable (%TagName), it
looks up the field position of the tag in <file> and converts the
tag name variable to a field variable ($1, $2, etc.) before executing
awk.
Arguments starting with "-" immediately after tagawk are considered
to be options.
You can only specify one <file>.
If <file> is not specified or specified as "-" then the command reads
from standard input.
If <file> is a zero-byte file, an error occurs.
If <file> is a null file (tag line only) the command executes properly.
$ cat file
TAG1 TAG2 TAG3
1000 2000 3000
1500 2500 3500
$ tagawk 'NR==1{print $0,"TAG4"}NR>1{print $0,%TAG1+%TAG2+%TAG3}' file
TAG1 TAG2 TAG3 TAG4
1000 2000 3000 6000
1500 2500 3500 7500