Skip to main content

## stat

The stat command provides basic statistics on the number of records and fields in CSV data files. For example, running the command:

csvfix stat data/names.csv

produces this output:

"data/names.csv","7","3","3"

which says that names.csv contains 7 records, the shortest of which contains 3 fields, and the longest of which contains 3 fields. Note that the number of records is not necessarily the same as the number of lines in the file, as a CSV record can span multiple lines.

Using the -fs option produces a more detailed report, with one record per field in the input file. For example:

csvfix stat -fs data/army.csv

produces:

"data/army.csv","1","string","4","5"

"data/army.csv","2","string","3","4"

"data/army.csv","3","string","5","9"

where the second field is the index of the field, the third is the field's type, and the remaining two are the minimum and maximum field lengths. Using the -fn option with -fs produces output with named fields instead of indexes, assuming the input contains a field name record at its start. So:

csvfix stat -fs -fn data/army.csv

produces:

"data/army.csv","name","string","4","5"

"data/army.csv","rank","string","3","3"

"data/army.csv","serial_no","number","5","5"

Created with the Personal Edition of HelpNDoc: Full-featured multi-format Help generator

####