This HTML automatically generated with rman for NEMO
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 thus 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 multiple columns.

To select specific rows/lines, use tabrows(1NEMO) or tabmath(1NEMO) .

To align a table by column, use the column(1) program with the -t option.

Parameters

The following parameters are recognized in order; they may be given in any order if the keyword is also given. Use --help to confirm this man page is up to date.
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. Column 0 can also be added to the output, which is the row number (first row 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]

colsepin=
Column separator for input. By default an internal set (space, comma, tab, vertical bar) is used. A string can be specified here consistent of multiple characters.

out=-
output file name. By default standard output it used.
[-]

Caveats

Although this program uses the new table interface, there are still some internal variables that limit the column count.

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
or in one long row:
    tabcols in.tab all n | tabtranspose - - > out.tab

See Also

tabrows(1NEMO) , tabtranspos(1NEMO) , tabmath(1NEMO) , tabs(1NEMO) , tabtab(1NEMO) , awk(1) , column(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
5-may-2022    V2.1 converted to table V2 interface    PJT
10-sep-2024    V2.4 added colsepin=    PJT


Table of Contents