Read a file in reverse-last line first
Posted: 05 Jan 2015 21:55
Sorry if this is a dumb question. In a batch file I want to read a sorted file, DIR.DAT, which has
lines like this:
B01001001.txt
B01001002.txt
B02001001.txt
etc. (data represents book#, chapter#, page#, and used in a book reading application all done in a batch file.)
The target I am looking for is the first 3 characters, for example B22
What I want to determine is which line has the last occurrence of the target.
If I were searching for B01, for the above example data, the answer would be 2 (line 2).
Is there a reverse-file-read method?
Thanks.
lines like this:
B01001001.txt
B01001002.txt
B02001001.txt
etc. (data represents book#, chapter#, page#, and used in a book reading application all done in a batch file.)
The target I am looking for is the first 3 characters, for example B22
What I want to determine is which line has the last occurrence of the target.
If I were searching for B01, for the above example data, the answer would be 2 (line 2).
Is there a reverse-file-read method?
Thanks.