David Muir Sharnoff > tsv-0.4 > tsv

Download:
modules/tsv-0.4.tar.gz

Annotate this POD

View/Report Bugs
Source  

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 STDIN. 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. The first row of the data must be column names. The input will be split and assigned to variables named by the column names: if there is a column named best before, then there will be a variable $best_before that has the data corresponding to the best before column for that row. The entire row will be in $_. The first row will always print since it's a header. A true value from the code will cause the line to print. Do not use return: 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. This will not pad the number of columns to match the header.

-n --head COUNT

Only process until there are COUNT lines of data output. This can be combined with all the other options except --show. The header does not count towards the count.

LICENSE ^

Copyright (C) 2008, 2009 David Sharnoff. Copyright (C) 2013 Google, Inc.

This package may be used and redistributed under the terms of either the Artistic 2.0 or LGPL 2.1 license.

syntax highlighting: