Computing.Net > Forums > Programming > How to read the 3rd line from the T

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How to read the 3rd line from the T

Reply to Message Icon

Name: vinoth124
Date: June 15, 2008 at 23:36:54 Pacific
OS: Windows XP
CPU/Ram: NA
Product: NA
Comment:

Hi Friend,

In batch code, is it possible to read a particular line from the text file.

For eg.,
Text file "test1.txt" contains the following text....

data1
data2
data3
data4
data5


I need to read the 3 line of the "test1.txt" file and print that line alone
(Ie.., It should echo the 3 line alone "data3")

Is there any option to resolve this issue....

Thank in Advance.

Urs,
Vinoth



Sponsored Link
Ads by Google

Response Number 1
Name: klint
Date: June 16, 2008 at 01:29:56 Pacific
Reply:

@echo off
for /f "skip=2 delims=" %%a in (file.txt) do (
echo Third line is "%%a"
goto :next
)
:next
echo Done.


0
Reply to Message Icon

Related Posts

See More


batch file string parsing ping bat file



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: How to read the 3rd line from the T

How to read bit in C www.computing.net/answers/programming/how-to-read-bit-in-c/10123.html

VBS - How to read file contents www.computing.net/answers/programming/vbs-how-to-read-file-contents/14629.html

batch file to read last four lines. www.computing.net/answers/programming/batch-file-to-read-last-four-lines/18671.html