Computing.Net > Forums > Disk Operating System > three lines from txt into a var

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.

three lines from txt into a var

Reply to Message Icon

Name: sami-bami
Date: February 26, 2004 at 15:14:23 Pacific
OS: 98
CPU/Ram: 128
Comment:

hello.

how can i make my batch to
take line 3-5 (from a text file) and put it into one variable ???

so when i will [echo %var%]
i will see the three lines just like the text file.



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: February 27, 2004 at 08:38:39 Pacific
Reply:

Hi
I don't know of a way to get carriage line+linefeed into an environment variable.
you could put them into 3 variables using a third party program called change with is an old PC magizine utility I have which changes text within a text file.
Then you could then echo the 3 variables to the screen.

Another way is to use find /n which puts a line number before the lines ie.

[3] text
[4] text
[5] text

and create a batch file to echo these to a
seperate file and type "type filename"
instead of "echo %Var%".
again you could delete the line numbers useng the change utilty above or leave them in.

You may be able to find the Change file on the net, it not I'll sent you a copy.

If you need help with code let me know.



0
Reply to Message Icon

Related Posts

See More


Want to rename sequential... DOS Bootdisk with FDISK/F...



Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: three lines from txt into a var

extract n last line from text file www.computing.net/answers/dos/extract-n-last-line-from-text-file/13852.html

Set number of lines from a file to a var www.computing.net/answers/dos/set-number-of-lines-from-a-file-to-a-var/6487.html

import from txt www.computing.net/answers/dos/import-from-txt/13645.html