NAME

fmtcolumn - format selected columns


SYNOPSIS

fmtcolumn [options] [-R] column fmt [ [-R] column fmt] ...


OPTIONS

-help
Print this help information.

-fXXX
The column names and formats are in XXX instead of on the command line. The advantage in this case is that no quoting of chars that might be special to the UNIX shell is necessary.

-r
This indicates that column names contain Perl regular expressions.

-R
This should precede column name specifications which contain Perl regular expressions when the global -r option is not used. For example:
        fmtcolumn -r 'hoo_\d+' 'boo_\d+' %.4f

indicates that all columns contain Perl regular expressions, while

        fmtcolumn 'hoo_\d+' -R 'boo_\d+' %.4f

indicates that only the second column specification is a regular expression; the first column specification must match a column name exactly

-n
Only perform the format if the value is non-null. This presents null numeric fields from being turned into zeros.


DESCRIPTION

Format selected columns according to the Perl sprintf formatting commands specified. Other columns are left untouched. Chars that are special to the UNIX shell must be quoted. Column name specifications may contain Perl regular expressions (see the -r and -R options ).

This operator reads an rdbtable via STDIN and writes an rdbtable via STDOUT. Options may be abbreviated.

For example, if the input rdbtable, sample1, looks like this:

        composition     energy  eps_i   eps_r
        -----------     ------  -----   -----
        ir      2.0100037999999   0.00020474961 0.9990628891
        ir      2.0150032000000   0.00020219905 0.9990769028
        ir      2.0200040999999   0.00019891983 0.9990938154

The following command

        fmtcolumn energy %.5f eps_i %e eps_r %f

produces:

        composition     energy  eps_i   eps_r
        -----------     ------  -----   -----
        ir      2.01000 2.047496e-04    0.999063
        ir      2.01500 2.021991e-04    0.999077
        ir      2.02000 1.989198e-04    0.999094


AUTHOR

Diab Jerius ( djerius@cfa.harvard.edu )