LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

csv-diff

compare CSV files and show differences

TLDR

Diff two CSV files
$ csv-diff [old.csv] [new.csv]
copy
Diff with specific key column
$ csv-diff [old.csv] [new.csv] --key [id]
copy
Output as JSON
$ csv-diff [old.csv] [new.csv] --json
copy
Show only changes
$ csv-diff [old.csv] [new.csv] --show-unchanged
copy

SYNOPSIS

csv-diff [options] old.csv new.csv

DESCRIPTION

csv-diff compares two CSV, TSV, or JSON files and shows added, removed, and changed rows. It's useful for tracking changes in data exports, database dumps, or any tabular data.A --key column must be specified so rows can be matched across files. Output is human-readable by default, and machine-readable JSON is available via --json.The tool is a standalone Python package by Simon Willison, installable via `pip install csv-diff`. It is distinct from csvkit.

PARAMETERS

--key column

Column to use as unique identifier.
--json
Output in JSON format.
--show-unchanged
Include unchanged rows in output.
--singular name
Singular noun for rows.
--plural name
Plural noun for rows.

CAVEATS

Rows without a stable unique key cannot be meaningfully compared; choose a column guaranteed to be present on both sides. Large files are loaded fully into memory.

SEE ALSO

csvkit(1), diff(1), jq(1)

Copied to clipboard
Kai