translate_fields(1)

NAME

translate_fields - convert field values based on user-supplied mappings.

SYNOPSIS

translate_fields <-fF> [-hdaprmexk] <-f <N> | -F <S>> [options] [file ...]

DESCRIPTION
convert field values based on user-supplied mappings.

-h  --help
    print this message and exit

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

-f field   --field=field
    index of the field to translate

-F field_label   --Field-label=field_label
    column label of the field to translate

-a  --append
    append the translated field after the original field

-p  --prepend
    prepend the translated field before the original field

-r  --replace
    replace the original field with the translated field

-m map   --map=map
    specifies a translation mapping for a possible field value (may be specified multiple times)

-e external   --external=external
    specifies a file containing perl expressions which define mappings in the hashtable "%mapping"

-x xpression   --xpression=xpression
    specifies a list of regular expressions to apply to the specified input field

-k  pass the first line of input through unmodified.

* Mappings passed to -m are specified as "K=V" pairs where K is a possible value for the field, and V is the translation.
     * Replacing is the default behavior, but for replacement to occur in addition to appending or prepending, -r must be specified.
     * If no mapping is supplied for a field value, the value is unchanged (the header is preserved unless a mapping is specified for the header value) The file specified by -e may have statements like {{{
      $mapping{hello} = 'salve';
      $mapping{world} = 'orbis terrae'; }}} or {{{
      %mapping = ("hello" => "salve", "world" => "orbis terrae"); }}} The latter will nullify any -m parameters passed on the commandline.

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.