Skip to content

Latest commit

 

History

History
60 lines (42 loc) · 972 Bytes

count.md

File metadata and controls

60 lines (42 loc) · 972 Bytes

xan count

The count command returns the number of rows of a CSV file.

It will not include the header row in the returned count, unless you provide the -n/--no-headers flag.

So, given this particular file:

people.csv

name surname
John Black
Lucy Red
Guillaume Orange

The following command:

xan count people.csv

Will return 3.

Counting CSV files having no headers

Given this file:

people.csv

John Black
Lucy Red
Guillaume Orange

The following command:

xan count -n people.csv

Will return 3.

Note that this is not always identical to the simpler:

wc -l people.csv

because the xan count command is of course CSV-aware and will be able to tolerate properly escaped newlines within cell values.