How do I replace variable with another variab

March 4, 2011 at 07:53:51
Specs: Windows XP
How do I replace variable with another variable? I have a file containing strings and these strings have equivalent IP address. I want my batch file to replace strings with their equivalent IP add.
Example: myfile.txt
Yahoo = 192.168.36.1
Google = 192.168.36.3
youtube = 192.168.36.5
Can someone help me here. Thank you in advance.

See More: How do I replace variable with another variab

Report •

#1
March 5, 2011 at 05:39:49
What should be in the resulting file?


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

M2


Report •

#2
March 5, 2011 at 18:44:59
My myfile.txt only containing (yahoo,google,youtube). I want to have an output of their corresponding ip address in the same file (myfile.txt) if possible, if not, in new text file.

Report •

#3
March 5, 2011 at 18:49:08
I want to have output of 192.168.36.1, 192.168.36.3 , 192.168.36.5..

Report •

Related Solutions

#4
March 6, 2011 at 08:38:50
Hi
Is this what you want.

@echo off
type nul >Temp.txt
for /f "tokens=1-3 delims= " %%a in (MyFile.txt) do (
echo %%c>>Temp.txt
)
type Temp.txt


Report •

#5
March 6, 2011 at 23:41:35
No. The ip adresses is not included in myfile.txt. Maybe I need to do SET or SET MAP to set their ip addresses but i dont know how..

Report •

Ask Question