CLI Reference¶
csvsmith provides a command-line interface (CLI) for common CSV processing tasks.
All commands follow this general structure:
csvsmith <command> [options]
—
Available commands¶
The following subcommands are available:
Data transformation¶
clean-numeric— Normalize numeric values in text fieldsclean-currency-numeric— Normalize currency-prefixed numeric valuesdedupe— Remove duplicate rowsdrop-rows— Filter rows based on conditions
File operations¶
excel-to-csv— Convert Excel files to CSVmove-files— Move or organize files based on rulesstrict-concat— Concatenate CSV files with identical headers
Analysis¶
classify— Categorize or label datafind-matches— Search for matching records
See the Tools section for detailed usage of each command.
—
Quick examples¶
Convert Excel to CSV:
csvsmith excel-to-csv input.xlsx -o output.csv
Remove duplicates:
csvsmith dedupe data.csv -o clean.csv
Clean numeric fields:
csvsmith clean-numeric "1,200.50" --sep "," --decimal "."
Clean currency-prefixed numeric fields:
csvsmith clean-currency-numeric '$1,234.56'
Note
When using values starting with $ (e.g., "$1234.56") in the shell,
be aware that the shell might attempt to expand it as a variable.
Always use single quotes ('$1234.56') to prevent unexpected expansion.
—
Global options¶
Some options are shared across multiple commands:
-o, --outputSpecify output file or directory.-h, --helpShow help message for a command.
To see command-specific options:
csvsmith <command> --help
—
Command help¶
Each subcommand provides its own help message:
csvsmith clean-numeric --help
This will display:
available options
required arguments
usage examples
—
Notes¶
Commands are designed to be composable in scripts and pipelines.
Input files are not modified unless explicitly overwritten.