Is there a way to read the last 20 lines of a text file. The text file will vary in length. Can I start at the end of file and go up 20 line then read in these lines.
thanks.
Are the lines in the text file a constant length? If so, you could open the file, seek to the end of the file using the fseek command, and then fseek backwards in the file to get to the beginning of the 20 lines at the bottom of the file.
There are no examples that I am aware of that meet your criteria. As for your other question (didn't show up when I posted my response), you can use the strfind command to see if a line read from the text file contains the string of text you are looking for.
How do I make this work? I'm trying to see if the user input the word NPA, NXX or SPN back earlier in program.These would be assigned to the bartype veriable.
I'm trying to say IF strfind bartype is NXX or NPA or SPN then do this? with one if then statement. Is this possible or is there a better way. I'm sure this is simple but I'm just learning.I can't figure this out.
Thanks!!
sdlginput "Gathering Information..." "Enter the either NPA,NXX or SPN :" bartype 3 DEFAULT
if FAILURE
goto Quit
else
endif
if strfind bartype "NPA"|"NXX"
sdlgmsgbox "" "Do you have Deny codes?" question yesno denycode
if denycode == 6
sdlginput "In the format C:\file\denycodes.txt" "Enter the text file they are stored in." storedfile DEFAULT
Hello all,
I'd like to write a script doing this
1- Using "DOS" ping command and ping a list of hosts on the same subnet.
2- Create a directory for each host in this ipaddress format 127_0_0_1.
3- Using "tftp get ip_host" to get configuration file.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.