svacx
svacx

Reputation: 357

Fastest way to count lines in a file

I have huge CSV file, which I want to know the total number of rows in which. Currently I am using something like this, which works perfectly, but it's slow:

FIND /c ";" FILENAME.csv

But I dunno if that's the fastest way to iterate through all lines in a CSV. Any suggestions or method you can teach me? My CSV files have over 100 000 lines.

PS: Please can you include the execute time aswell?

Thanks.

Upvotes: 1

Views: 3696

Answers (1)

npocmaka
npocmaka

Reputation: 57252

for /f "tokens=1 delims=:" %%# in ('find /c /v "" ^< FILENAME') do set "linescount=%%#"
echo %linescount%

Upvotes: 5

Related Questions