reverse

April 1, 2026 · View on GitHub

Reverse order of rows in a CSV. Unlike the sort --reverse command, it preserves the order of rows with the same key. If an index is present, it works with constant memory. Otherwise, it will load all the data into memory.

Table of Contents | Source: src/cmd/reverse.rs | 📇🤯

Description | Usage | Common Options

Description

Reverses rows of CSV data.

Useful for cases when there is no column that can be used for sorting in reverse order, or when keys are not unique and order of rows with the same key needs to be preserved.

Note that if the CSV is not indexed, this operation will require reading all of the CSV data into memory

Usage

qsv reverse [options] [<input>]
qsv reverse --help

Common Options

     Option     TypeDescriptionDefault
 ‑h,
‑‑help 
flagDisplay this message
 ‑o,
‑‑output 
stringWrite output to instead of stdout.
 ‑n,
‑‑no‑headers 
flagWhen set, the first row will not be interpreted as headers. Namely, it will be reversed with the rest of the rows. Otherwise, the first row will always appear as the header row in the output.
 ‑d,
‑‑delimiter 
stringThe field delimiter for reading CSV data. Must be a single character. (default: ,)
 ‑‑memcheck flagCheck if there is enough memory to load the entire CSV into memory using CONSERVATIVE heuristics.

Source: src/cmd/reverse.rs | Table of Contents | README