|
Answer» 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.
Urs, Vinoth
I've not been able to figure this out (If it is at all possible)try this setlocal ENABLEDELAYEDEXPANSION set /a cont=1 for /f "delims=" %%i in (New.txt) do ( if "!count!" EQU "3" echo %%i set /a count=!count!+1 ) echo u have !count! lins in New.txt pause endlocalHi friend,
When i try to execute your code, the count was not increasing.... Since I am new to DOS envrn, please help me to resolve this issue.....
This is the DOS SCREEN................
D:\>set /a count=1 1 D:\>for /f "delims=" %i in (cbs.txt) do set /a count=%count%+1
D:\>set /a count=1+1 2 D:\>set /a count=1+1 2 D:\>set /a count=1+1 2 D:\>set /a count=1+1 2 D:\>set /a count=1+1 2 D:\>
******************************************************************
Thanks In Advance.(For your timely help)
With Regards, Vinoth R
u should put the command setlocal ENABLEDELAYEDEXPANSION or the code will not work put this code inside abat file and execute it , it will workQuote from: vinoth124 on June 12, 2008, 05:20:02 AM D:\>for /f "delims=" %i in (cbs.txt) do set /a count=%count%+1
i DIDNT wrote this it was set /a count=!count!+1
|