NAME

column - select columns from an rdbtable


SYNOPSIS

column [options] arguments


OPTIONS

-help
Print this help information.

-r
treat all column names as if they were Perl regular expressions. This does not affect any -c or -d options. See below.

-v
Inverse option. Selects all columns except those named.

-warn
Print out warnings if specified columns don't exist, or already exist. Usually column quietly ignores problems like this.


ARGUMENTS

The argument list may contain column names, standalone options, doublets of the form option arg and triplets of the form option arg1 arg2.

Column Names

Isolated column names indicate that those columns are slated either for deletion or retention, depending upon whether the -v or -V option has been specified. By default the specified columns are slated for retention.

Standalone Options

The standalone options are:

-V
Turn off selection inversion (see the -v switch in OPTIONS).

-v
Turn on selection inversion (see the -v switch in OPTIONS).

-Z
This will insert (or delete) all of the columns which have not yet been specified.

Doublet Options

Doublet options have the following forms:

-R regular expression
The following column name is treated as if it were a Perl regular expression. This is a localized version of the -r option.
        column foo -R 'boo*'

-s regular expression
The columns which match the regular expression will be lexically sorted by name and inserted (or deleted, which isn't very useful).

For example, if the input table has the following column list:

        xB xD xC xA cE cA cD cB cX
        column -s '^x' -s '^c'

will result in an order of

        xA xB xC xD cA cB cD cE cX

-S regular expression
Similar to the -s option, except that the sort will be done in reverse lexical order.

Triplet Options

The triplet options have the following forms:

-a name defn
add a new (null) column with name name and definition defn. if <defn> is -, a definition will be composed of - characters, the same number of characters as are in name.

-c name new
Change the column name to new.

-C name new
Change the column name to new. name is treated as a Perl regular expression. new may contain subexpression matches, e.g.
        -C  'K(.*)F' 'Q$1'

would change 'KuuF' to 'Quu'

-d name new
create a duplicate of column name with name new

-D name new
create a duplicate of column name with name new. name is treated as a Perl regular expression. new may contain subexpression matches, e.g.
        -D  'K(.*)F' 'Q$1'

duplicates 'KuuF' as 'Quu'

-t name def
Change the definition of column name to def.

-T name def
Change the definition to def. name is treated as a Perl regular expression.


DESCRIPTION

This RDB operator reads an rdbtable from STDIN and writes an rdbtable to STDOUT. Options may be abbreviated.

It selects columns by name (and order) and outputs an rdbtable with these columns. It effectively select, order, add, delete, or duplicate columns.

As an example to select columns named 'NAME' and 'COUNT' the command would be:

        column  NAME  COUNT  <  sample

To select all columns except column 'NAME' the command would be:

        column  -v  NAME  <  sample

To add a new column named 'LENGTH' with a size of 10 the command would be:

        column  -v  -a  LENGTH  10  <  sample

Note that to include documentation with the new column definition the command would be:

        column  -v  -a  LENGTH  '10 length in meters'  <  sample

The '10 length in meters' must be quoted so that it will be treated as a single token.


AUTHOR

Original by Walter V. Hobbs

Rewritten and extended by Diab Jerius ( djerius@cfa.harvard.edu ).