Assigning the last line of a txt file to a value
Posted: 09 Sep 2011 16:25
I'm almost there! I have a script which will search through a txt file (list.txt) to the very last line (or record).
This last line is always a decimal number between 1 and 1000.
I'd like to be able to assign this to a value in a batch file, but cannot understand how to import this one line of
data from the file.
I'm building a rudimentary CD database, all I want is the disk number (that begs the question above).
1) open the data file
2) read the last entry (it is the disk number)
3) increment the number by 1
4) write this number to the file
5) send the disk directory contents to the file
6) write the same disk number to the file.
(That way when I search for the disk number, each disk's directory is between the two same numbers)
I've got everything but item (2). Right now I have to enter the next disk number manually and I would like to
automate this.
I'm having to learn the batch file language after all these years. I usually do 'most everything in Turbo Basic (yes I am THAT old), but every Basic I find will only export filenames in 8.3. Even when SHELLing to a command file. Ahhhrghh!
Would really appreciate some help, I thank you in advance
-- Doc
This last line is always a decimal number between 1 and 1000.
I'd like to be able to assign this to a value in a batch file, but cannot understand how to import this one line of
data from the file.
I'm building a rudimentary CD database, all I want is the disk number (that begs the question above).
1) open the data file
2) read the last entry (it is the disk number)
3) increment the number by 1
4) write this number to the file
5) send the disk directory contents to the file
6) write the same disk number to the file.
(That way when I search for the disk number, each disk's directory is between the two same numbers)
I've got everything but item (2). Right now I have to enter the next disk number manually and I would like to
automate this.
I'm having to learn the batch file language after all these years. I usually do 'most everything in Turbo Basic (yes I am THAT old), but every Basic I find will only export filenames in 8.3. Even when SHELLing to a command file. Ahhhrghh!
Would really appreciate some help, I thank you in advance
-- Doc