|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to find the number of lines in txt file using DOS?
Hi Everyone,
In batch code, is it possible to count the number of files from the text file For eg., Text file "Src.txt" contains the following text.... uuuuu vvvvvv xxxxxx yyyyyy zzzzzz I need to find the number of lines available in "Src.Txt" and also i need to print(echo) the 3rd line. Is there any option to resolve this issue..., Please help me to resolve this issue...., Thank in Advance. Ur, Vinoth |
|
#2
|
|||
|
|||
|
as far as i am aware, there is nothing built in to DOS to perform such a task but it can easily be done with some quickbasic/qbasic code. try this:
OPEN "SRC.TXT" FOR INPUT AS #1 counter = 0 DO UNTIL EOF(1) LINE INPUT #1, dummy$ IF counter = 3 THEN thirdline$ = dummy$ counter = counter + 1 LOOP CLOSE #1 PRINT "The file SRC.TXT contains" + STR$(counter) + " lines of text." PRINT "This is the third line: " + thirdline$ |
![]() |
| Viewing: Web Development Archives > FAQs > MS DOS > How to find the number of lines in txt file using DOS? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|