Read from 2nd line

October 20, 2010 at 20:41:53
Specs: Windows XP
Hi All ,


I just like to read txt from the 2 nd line thats all.
I've a txt file result.txt ;

1
2
3
4
5


I've something like ;
@echo off
set /p var=<result.dat
echo The variable is "%var%"

How may i set the var to extract my line 2 ??

Thanks in advance


See More: Read from 2nd line

Report •

#1
October 20, 2010 at 22:11:44
@echo off & setLocal EnableDELAYedeXpansion

for /f "skip=1 tokens=* delims= " %%a in (myfile) do (
set V=%%a
goto :done
)
:done
echo.!V!


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
October 20, 2010 at 23:19:24
Thank you very much M2.
One more smaller issue ..
How may i trim using batch script ?

I've got a space in front " Test" need to trim to "Test"


Report •

#3
October 21, 2010 at 00:43:45
Show your script.


=====================================
Life is too important to be taken seriously.

M2


Report •
Related Solutions


Ask Question