Recipes

1. Inspect the first twenty rows

Task: display a compact preview of a TSV file with named columns.

tsvpeek --header --table --limit 20 data.tsv
id   name      state
---  --------  -----
1    alpha     ready
2    beta      wait
...

2. Select three named columns

tsvpeek --header --columns id,name,state data.tsv
1	alpha	ready
2	beta	wait

3. Keep rows with one exact value

tsvpeek --header --where 'state=ready' data.tsv
1	alpha	ready	1040
3	gamma	ready	2048

4. Apply two conditions

tsvpeek \
  --header \
  --where 'state=ready' \
  --where 'bytes:num>=1000' \
  data.tsv
1	alpha	ready	1040
3	gamma	ready	2048

5. Search for text inside a field

tsvpeek --header --where 'name~cache' data.tsv
41	cache-main	ready	600
57	cache-old	disabled	120

6. Count matching rows

tsvpeek --header --where 'state=ready' --count data.tsv
18427

7. Read CSV and emit TSV

tsvpeek --csv --output-delimiter '\t' input.csv
1	alpha	ready
2	beta	wait

8. Sort a small filtered result

tsvpeek \
  --header \
  --where 'state=ready' \
  --sort bytes:num:desc \
  --limit 10 \
  data.tsv
91	archive-a	ready	983040
44	part-17	ready	540100
18	block-2	ready	104400

9. Remove duplicate keys

tsvpeek --header --unique id data.tsv
1	alpha	ready
2	beta	wait
3	gamma	ready

10. Find malformed rows

tsvpeek --expected-fields 4 --line-number data.tsv

With normal diagnostic output, records whose field count differs from four are reported with their source line number.

11. Ignore malformed records

tsvpeek \
  --expected-fields 4 \
  --skip-bad \
  data.tsv
1	alpha	ready	1040
3	gamma	ready	2048

12. Process compressed input from another command

gzip -dc data.tsv.gz |
  tsvpeek --header --columns name,state --limit 25
alpha	ready
beta	wait
gamma	ready