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 2048Command:
tsvpeek --header --table items.tsvOutput:
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.csvCSV mode handles quoted fields and delimiters occurring inside quoted values.
Select columns
tsvpeek \
--header \
--columns name,bytes \
items.tsvOutput:
alpha 1040
beta 80
gamma 2048Without --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.tsvMultiple 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.tsvOffset applies after filtering. The header is not counted as a data row.
Formatted table output
tsvpeek \
--header \
--table \
--max-width 32 \
items.tsvTable formatting is intended for terminal inspection. For data intended for another command, leave --table disabled.
Exit status
| Status | Meaning |
|---|---|
0 | Processing completed successfully. |
1 | Input or output error. |
2 | Invalid command-line option or expression. |
3 | Malformed input encountered in strict mode. |