Find number of lines in a CSV file

 

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.

 
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. 
  1. Remember the count and skip them next time. Or, remember the file size and seek to that next time before reading.
  2. How are you going to handle restarts, terminal/OS crash, power failure, etc., and not duplicate previous actions?
  3. 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
Reason: