1.

Solve : parse string from textfile with Batch (Dos 7.10)?

Answer»

Hello,

I have a list with PC-names and ip adresses like this:

PC1. 1.1.1.1
PC3. 2.3.5.3
...

and need only the ip adress in a variable.
Between PC-Name and IP-Adress is a blank.

The OS is M$-DOS 7.10

thanks in advance for any help
uli
From the command line:

for /f "tokens=1-2" %a in (ip.txt) do echo %b

From a batch file double up on the % symbols:

for /f "tokens=1-2" %%a in (ip.txt) do echo %%b

Note: I chose ip.txt as an arbitrary name for your file. You can change it accordingly.

Hope this helps. Thanks for help Sidewinder.

But the f switch isn´t WORKING in standalone dos.
(Thats my little problem) :-(

uliSorry about that. According to my trusty DOS manual, the FOR had no switches in those days. Without the /f switch you're SOL.

You MAY actually have to WRITE a QBASIC program to read the file and PROCESS the data.

:-/I found a solution. :-)

Just for info:

The berkeley - tools are a collection of unix tools for dos.
(It was commercial but is freeware now)

http://short.stop.home.att.net/freesoft/unix.htm

Now I am happy to have cut...... :-) :-) :-)

uli



Discussion

No Comment Found