td-add-headers - Add headers to the tabular data stream and pass through the rows.



NAME

td-add-headers - Add headers to the tabular data stream and pass through the rows.


SYNOPSIS

td-add-headers <COLNAME_1> <COLNAME_2> ...


DESCRIPTION

Add header row to the tabular data stream. Headers names will be the ones specified in the command line arguments, from the left-most 1-by-1.

If there are more fields in the first data row, then additional columns will be added with names like "COL4", "COL5", etc. by the index number of the column counting from 1. This may be prevented by --no-extra-columns option.


OPTIONS

-x, --extra-columns

Name columns too which are not given name in the command parameters.

-X, --no-extra-columns

Do not add more columns than specified in the command parameters.


EXAMPLE

who | tr-trans | td-add-headers USER TTY DATE TIME COMMENT

 td-alter - Add new columns and fields to tabular data stream, and modify value of existing fields.



NAME

td-alter - Add new columns and fields to tabular data stream, and modify value of existing fields.


USAGE

td-alter <COLUMN>=<EXPR> [<COLUMN>=<EXPR> [<COLUMN>=<EXPR> [...]]]


DESCRIPTION

On each data row, sets field in <COLUMN> to the value resulted by <EXPR> Perl expression. In <EXPR>, you may refer to other columns by bareword or by $Field{'COLUMN'} if you must, where COLUMN is a column name. You can create new columns simply by referring a <COLUMN> name not yet existing. You can use an earlier defined <COLUMN>'s value in a later defined <EXPR>.


EXAMPLES

ls -l | td-trans-ls | td-alter TYPE='substr MODE,0,1' BIGFILE='SIZE>10000000 && TYPE ne "d" ? "yes" : "no"'


OPTIONS

-H, --no--header

do not show headers

-h, --header

show headers (default)

 td-filter - Show only those records from the input tabular data stream which match to the conditions.



NAME

td-filter - Show only those records from the input tabular data stream which match to the conditions.


USAGE

td-filter [<OPTIONS>] [--] <COLUMN> <OPERATOR> <R-VALUE> [<COLUMN> <OPERATOR> <R-VALUE> [...]]

td-filter [<OPTIONS>] --perl <EXPR>


DESCRIPTION

Pass through those records which match at least one of the conditions (inclusive OR). You may put together conditions conjunctively (AND) by chaining multiple td-filter commands in the pipe. Example:

  td-filter NAME eq john NAME eq jacob | tr-filter AGE -gt 18

This gives the records with either john or jacob, and all of them will be above 18.

td-filter(1) evaluates the Perl expression in the second form and passes through only if the result is true-ish in Perl (non zero, non empty string, etc). Each field's value is in @F by index, and in %F by column name. You can implement more complex conditions in this way.


OPTIONS

-H, --no--header

do not show headers

-h, --header

show headers (default)

-i, --ignore-nonexisting-columns

do not treat non-existing (missing or typo) column names as failure

-w, --warn-nonexisting-columns

only show warning on non-existing (missing or typo) column names, but don't fail


OPERATORS

These operators are supported, semantics are the same as in Perl, see perlop(1).

 == != <= >= < > =~ !~ eq ne gt lt

For your convenience, not to bother with escaping, you may also use these operators as alternatives to the canonical ones above:

is : string equality

is not, isnt, isnot : string inequality

-eq : numerical equality

-ne : numerical inequality

<> : numerical inequality

-gt : numerical greater than

-ge : numerical greater or equal

-lt : numerical less than

-le : numerical less or equal

match : regexp match

notmatch : negated regexp match

have, has : substring match


CAVEATS

If there is no <COLUMN> column in the input data, it's silently considered empty. <R-VALUE> does not need quoting or escaping.

 td-group - Collapse sorted tabular data stream's rows with equivalent first fields into one row.



NAME

td-group - Collapse sorted tabular data stream's rows with equivalent first fields into one row.


SYNOPSIS

td-group [<OPTIONS>]


DESCRIPTION

It goes row-by-row and if 2 or more subsequent rows first (key) cell are the same then collapse them into one row. This is done by joining corresponding cells' data from each row into one cell, effectively keeping every column's data in the same column.

If you want to group by an other column, not the first one, then first reorder the columns by td-select(1). Eg. td-select OTHERCOLUMN +REST.


OPTIONS

-s, --separator STR

Separator character or string between joined cell data. Default is space.


EXAMPLES

This pipeline shows which users are using each of the configured default shells, grouped by shell path.

  # get the list of users
  getent passwd |\
  
  # transform into tabular data stream
  tr : "\t" |\
  td-add-headers USER X UID GID GECOS HOME SHELL |\
  
  # put the shell in the first column, and sort, then group
  td-select SHELL USER | td-keepheader sort | td-group -s ' ' |\
  
  # change header name "USER" to "USERS"
  td-alter USERS=USER | td-select +ALL -USER


CAVEATS

Have to sort input data first.

 td-keepheader - Plug a non header-aware program in the tabular-data processing pipeline



NAME

td-keepheader - Plug a non header-aware program in the tabular-data processing pipeline


USAGE

td-keepheader [--] <COMMAND> [<ARGS>]


EXAMPLE

ls -l | td-trans-ls | td-select NAME +REST | td-keepheader sort | tabularize

 td-pivot - Switch columns for rows in tabular data



NAME

td-pivot - Switch columns for rows in tabular data


SYNOPSIS

td-pivot


CAVEAT

Must read and buffer the whole STDIN before output any data, so inpractical on large data.

 td-select - Show only the specified columns from the input tabular data stream.



NAME

td-select - Show only the specified columns from the input tabular data stream.


USAGE

td-select [<OPTIONS>] [--] [-]<COLUMN> [[-]<COLUMN> [...]]


OPTIONS

-H, --no--header

do not show headers

-h, --header

show headers (default)

-i, --ignore-nonexisting-columns

do not treat non-existing (missing or typo) column names as failure

-w, --warn-nonexisting-columns

only show warning on non-existing (missing or typo) column names, but don't fail

--strict-columns

warn and fail on non-existing (missing or typo) column names given in parameters, even if it's prefixed with hyphen, ie. when the user want to remove the named column from the output.


DESCRIPTION

COLUMN is either a column name, optionally prefixed with hyphen, in which case the given column will not be shown, ie. removed from the shown columns, or one of these special keywords:

  +ALL    - all columns
  +REST   - the rest of columns not given yet in the parameter list

So if you want to show all columns except one or two:

  td-select +ALL -PASSWD

If you want to put a given column to the first place and left others intact:

  td-select ID +REST


EXAMPLE

  ls -l | td-trans-ls | td-select -- NAME +REST -INODE -LINKS -MAJOR -MINOR
 td-trans - Transform whitespace-delimited into TAB-delimited lines ignoring sorrounding whitespace and make duplicated header names unique.



NAME

td-trans - Transform whitespace-delimited into TAB-delimited lines ignoring sorrounding whitespace and make duplicated header names unique.

 td-trans-ls - Transform ls output into fix number of TAB-delimited columns.



NAME

td-trans-ls - Transform ls(1) output into fix number of TAB-delimited columns.


USAGE

ls -l | td-trans-ls


DETAILS

supported ls(1) options which affect its output format:

--human-readable
--inode
--recursive
--time-style={iso,long-iso,full-iso}

unsupported options:

--author
-g
-o
--time-style=locale
 td-trans-mount - Transform mount output to tabular data stream.



NAME

td-trans-mount - Transform mount(1) output to tabular data stream.


DESCRIPTION

Supported mount(1) options which affect output format:

-l (show labels)


EXAMPLES

mount | td-trans-mount

mount -l | td-trans-mount

 td2html - Transform tabular data stream into a HTML table.



NAME

td2html - Transform tabular data stream into a HTML table.


SYNOPSIS

td2html


DESCRIPTION

Takes a tabular data stream on STDIN and outputs a HTML table enclosed in <table>...</table> tags.

 td2mrkv - Transform tabular data into multi-record key-value format.



NAME

td2mrkv - Transform tabular data into multi-record key-value (MRKV) format.


OPTIONS

-s, --separator STR

String to separate field name from content. Default is TAB (\t).


EXAMPLE

getent passwd | tr : "\t" | td-add-headers USER PW UID GID GECOS HOME SHELL | td-select +ALL -PW | td2mrkv