calcfield(1)

NAME

calcfield - calculates the value for a new field based on existing fields

SYNOPSIS

calcfield <-e> [-hVvdpriBAbc] [file...]

DESCRIPTION
calculates the value for a new field based on existing fields

-h  --help
    print this message and exit

-V  --Version
    show version information and exit.

-v  --verbose
    print verbose messages during execution

-d delim   --delim=delim
    field separator string (default: 0xfe)

-p  --preserve-header
    preserve the header line (just passes the first line through to the output file)

-r  --replace
    replace the value at the given index (instead of adding a new column)

-i index   --insert=index
    index for the new fields (1-based); if not given the new field will be appended

-B label   --Before=label
    place the new field before the field with the specified label

-A label   --After=label
    place the new field after the field with the specified label

-e expr   --expression=expr
    the expression to calculate (see below)

-b fallback   --fallback=fallback
    if the formula is not properly evaluated use this result as the fallback

-c column_name   --new-label=column_name
    the name of the column for the calculated field; implies -p

The expression specified in -e may contain indexes of fields, e.g.

-e '[1] + [2]'

You may also use column labels in the expression:

-e '[Clicks] + [Impressions]'

Use of the latter form implies that the header should be preserved.

AUTHOR

Written by the maintainers and contributers of CRUSH tools.  See
    http://code.google.com/p/crush-tools

REPORTING BUGS

Report bugs to <crush-tools@googlegroups.com>, or visit
    http://groups.google.com/group/crush-tools

COPYRIGHT
   Copyright 2008 Google Inc.
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
       http://www.apache.org/licenses/LICENSE-2.0
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.