Usage

Command syntax

tsvpeek [flags] [file]

If file is omitted or is -, input is read from standard input.

Read a TSV file

Input:

id	name	state	bytes
1	alpha	ready	1040
2	beta	wait	80
3	gamma	ready	2048

Command:

tsvpeek --header --table items.tsv

Output:

id  name   state  bytes
--  -----  -----  -----
1   alpha  ready  1040
2   beta   wait   80
3   gamma  ready  2048

Read standard input

cat items.tsv |
  tsvpeek --header --limit 2

Read CSV data

tsvpeek --csv --header --table items.csv

CSV mode handles quoted fields and delimiters occurring inside quoted values.

Select columns

tsvpeek \
  --header \
  --columns name,bytes \
  items.tsv

Output:

alpha	1040
beta	80
gamma	2048

Without --header, columns can be addressed by one-based position:

tsvpeek --columns 2,4 items.tsv

Filter rows

tsvpeek \
  --header \
  --where 'state=ready' \
  --where 'bytes>=1000' \
  items.tsv

Multiple filters are combined with logical AND.

Supported operators:

=   !=   >   >=   <   <=
~   !~

~ and !~ perform substring matching and inverse substring matching.

Numeric comparison

Comparison is textual by default. Add :num to the column reference when numeric comparison is required.

tsvpeek \
  --header \
  --where 'bytes:num>100' \
  items.tsv

Limit and offset

tsvpeek \
  --header \
  --offset 100 \
  --limit 25 \
  items.tsv

Offset applies after filtering. The header is not counted as a data row.

Formatted table output

tsvpeek \
  --header \
  --table \
  --max-width 32 \
  items.tsv

Table formatting is intended for terminal inspection. For data intended for another command, leave --table disabled.

Exit status

StatusMeaning
0Processing completed successfully.
1Input or output error.
2Invalid command-line option or expression.
3Malformed input encountered in strict mode.