Table of Contents

Name

tabcols - Select columns, and optionally rearrange, from a table

Synopsis

tabcols [parameter=value] ...

Description

tabcols selects columns from a file, and can also re-arrange the output column order. New column separators can be used on output. This way a newline on input can be converted into a space on output and therefore creating a file with one long column from a table with mulitple columns.

To select lines, use tablines(1NEMO) or tabmath(1NEMO) .

Parameters

The following parameters are recognized in any order if the keyword is also given:
in=
input file name(s). No default.
select=
list of columns to select. Any nemoinp(1NEMO) expression can be used. Columns can be repeated, and in any order. The output will be in exactly the same order as given with this keyword. First column is 1. [all]
colsep=
Column separator. Valid are: s (space), n (newline), t (tab), r (carriage return), as well as the literal symbols ’,’ and ’:’. [Default: s]
out=-
output file name. By default standard output it used.

Example

Here is an example of how to reverse the columns from a table with 4 columns:
    tabcols in.tab 4:1:-1 > out.tab
and here is an example that re-arranges all the numbers in a table in one long column
    tabcols in.tab all n > out.tab

See Also

tablines(1NEMO) , tabmath(1NEMO) , tabs(1NEMO) , awk(1)

Files

src/kernel/tab/tabcols.c source code

Author

Peter Teuben

Update History


26-Jan-00    V1.0 Created     PJT
9-apr-09    V2.0 out=- now default and last argument    PJT


Table of Contents