NAME
tsv - general tsv file mangler
USAGE
tsv [options] file(s)
OPTIONS
--show Display column names
-f --cut COL,COL,COL like cut(1) but uses column names
--rotate Turn columsn to rows
--matchup FILE Rotate, grabbing header from FILE
--validate Discards rows that have wrong column count
-n --head COUNT Only process COUNT lines
--default VALUE Replace empty values with VALUE
--grep COLS PATTERN Search for pattern in cols
--select COLS CODE Eval code on cols, output if returns true
--help Display man page
DESCRIPTION
tsv is a collection of small tools for manipulating and reporting on TSV (tab separated values) files.
- --show
-
Displays a numbered list of the columns
- --cut COLUMN_NAME(S)
-
Outputs a new TSV with just the named columns. Columns must be named; separate column names with comma
,
. - --rotate
-
Turn the columns into rows and the rows into columns.
- --matchup FILE
-
Grab the first row from FILE and then rotate. Usually this is used when with grep:
grep stuff file.tsv | tsv --match file.tsv
- --grep COLUMNS PATTERN
-
Look for PATTERN in COLUMNS (comma separate list, names or numbers)
- --select CODE
-
Evaluate CODE. Each column will be in the variable
$colname
. A true value from the code will cause the line to print. Do not usereturn
: the code is inside a while loop, not a sub. - --validate
-
Only output rows that have the same number of columns as the header line.
- --default VALUE
-
Replace empty values with VALUE. This can be combined with --validate.
- -n --head COUNT
-
Only process COUNT lines of input. This can be combined with all the other options except --show.
LICENSE
This package may be used and redistributed under the terms of either the Artistic 2.0 or LGPL 2.1 license.