reverse
Reverses the order of lines (like tac).
Behavior:
- Reads all lines into memory. Large files may exhaust memory.
- Supports plain text and gzipped (
.gz) TSV files.
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/-H(FirstLine mode) and--header-hash1(HashLines1 mode). Seetva --help-headersfor details. - The header is written once at the top of the output, followed by reversed data lines.
Examples:
-
Reverse a file
tva reverse file.tsv -
Reverse a file, keeping the header at the top
tva reverse --header file.tsv -
Reverse a file with hash comment lines and column names
tva reverse --header-hash1 file.tsv