select
Selects and reorders TSV fields.
Behavior:
- One of
--fields/-for--exclude/-eis required. --fields/-fkeeps only the listed fields, in the order given.--exclude/-edrops the listed fields and keeps all others.- Use
--restto control where unlisted fields appear in the output.
Input:
- Reads from files or standard input.
- Files ending in
.gzare transparently decompressed.
Output:
- By default, output is written to standard output.
- Use
--outfileto write to a file instead.
Header behavior:
- Supports
--header/-Hand--header-hash1modes. - In header mode, field names from the header can be used in field lists.
Field syntax:
- Field lists support 1-based indices, ranges (
1-3,5-7), header names, name ranges (run-user_time), and wildcards (*_time). - Run
tva --help-fieldsfor a full description shared across tva commands.
Examples:
-
Select by name
tva select input.tsv -H -f Name,Age -
Select by index
tva select input.tsv -f 1,3 -
Exclude columns
tva select input.tsv -H -e Password,SSN