Find number of lines in a CSV file
Tatenda Maswedza: Can I also just know the number of lines in a CSV file.
Read each line, count them.
Tatenda Maswedza: if it's possible to account for the last row I executed so that the next time I check I only read instructions for newly added rows.
- Remember the count and skip them next time. Or, remember the file size and seek to that next time before reading.
- How are you going to handle restarts, terminal/OS crash, power failure, etc., and not duplicate previous actions?
- Perhaps you should delete the file after reading, thus avoiding № 2 and your question.
How To Ask Questions The Smart Way. (2004)
The XY Problem

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have a program which gets instructions from a CSV file, I want to know if it's possible to account for the last row I executed so that the next time I check I only read instructions for newly added rows. Can I also just know the number of lines in a CSV file.