ODT Column Extraction: odtcols
Keywords: userguide

Next: Oxs package management: oxspkg Up: Command Line Utilities Previous: ODT Table Concatenation: odtcat

##
ODT Column Extraction: odtcols

The odtcols utility extracts column subsets from ODT data table files.

Launching
The odtcols launch command is:

    tclsh oommf.tcl odtcols [standard options] [-f format] \
       [-m missing] [-q] [-s] [-S] [-t output_type] \
       [-table select] [-no-table deselect] [-w colwidth] \
       [col ...] <infile >outfile

where

`-f format`
  C printf-style format string for each output item. Optional. The default format string is `"%-${colwidth}s"`.
`-m missing`
  String used on output to designate a missing value. Default is the two character open-close curly brace pair, { }, as specified by the ODT file format.
`-q`
  Silences some meaningless error messages, such as "broken pipe" when using the Unix head or tail utilities.
`-s`
  Produces a file summary instead of column extraction. Output includes table titles, column and row counts, and the header for each specified column. If no columns are specified, then the headers for all the columns are listed.
`-S`
  Same as `-s` option, except the column list is ignored; headers for all columns are reported.
`-t output_type`
  Specify the output format. Here output_type should be one of the strings `odt`, `csv`, or `bare`. The default is `odt`, the ODT file format. Selecting `csv` will yield a ``Comma-Separated Values'' (CSV) file, which can be read by many spreadsheet programs. The `bare` selection produces space separated numeric output, with no ODT header, trailer, or comment lines. The latter two options are intended as aids for transferring data to third party programs; in particular, such output is not in ODT format, and there is no support in OOMMF for translating back from CSV or bare format to ODT format.
`-table select`
  Select tables to include in output. Tables are selected by index number; the first table in the file has index 0. The select string consists of one or more selections separated by commas, where each selection is either an individual index number or a range with inclusive endpoints separated by a colon. Example select string: `0:3,7,9:12`. Default is all tables.
`-no-table deselect`
  Specify tables to exclude from output. The deselect string has the same format at the `-table select` string. Default is to print all tables, so the effective default deselect string is the empty set.
`-w colwidth`
  Minimum horizontal spacing to provide for each column on output. Optional. Default value is 15.
`col ...`
  Output column selections. These may either be integers representing the position of the column in the input data (with the first column numbered as 0), or else arbitrary strings used for case-insensitive glob-style matching against the column headers. The columns are output in match order, obtained by processing the column selections from left to right. If no columns are specified then by default all columns are selected.
``<`infile`
  odtcols reads its input from stdin. Use the redirection operator ```<`'' to read input from a file.
``>`outfile`
  odtcols writes its output to stdout. Use the redirection operator ```>`'' to send output to a file.

Commonly the `-s` switch is used in a first pass, to reveal the column headers; specific column selections may then be made in a second, separate invocation. If no options or columns are specified, then the help message is displayed.

OOMMF Documentation Team
September 29, 2018