blank
Replaces consecutive identical values in selected columns with a blank string (or a custom value).
Behavior:
- For each selected column, the current value is compared with the value in the previous row.
- If the values are identical, the current cell is replaced with an empty string (or the specified replacement value).
- If the values differ, the current value is written, and it becomes the new reference for subsequent rows.
- Blanking is stateful across file boundaries when multiple files are provided.
- Use
-i/--ignore-caseto compare values case-insensitively.
Input:
- Reads from files or standard input.
- Files ending in
.gzare transparently decompressed.
Header behavior:
- Supports
--header/-Hand--header-hash1modes. - When using header mode with multiple files, only the header from the first file is written; headers from subsequent files are skipped.
Field syntax:
- Use
-f/--fieldto specify columns to blank. - Format:
COL(blank with empty string) orCOL:REPLACEMENT(blank with custom string). - Columns can be specified by 1-based index or, if
-His used, by header name. - Run
tva --help-fieldsfor a full description shared across tva commands.
Output:
- By default, output is written to standard output.
- Use
--outfileto write to a file instead.
Examples:
-
Blank the first column
tva blank -H -f 1 data.tsv -
Blank the ‘category’ column with “—”
tva blank -H -f category:--- data.tsv -
Blank multiple columns
tva blank -H -f 1 -f 2 data.tsv