find text string in line & replace whole line

July 6, 2010 at 14:48:56
Specs: xp, 4gb
Let's say I have a text file with a few hundred
lines of text:

i.e.

ID=1234
User=remgu
Password=somepassword
Location=California

I need a batch file that will search for the text
string "password" and then replace the whole
line, including everything after the equal sign.

i.e.

ID=1234
User=remgu
Password=anotherpassword
Location=California

Background:
I am using a program that uses
the above information to log in. But the
program encrypts the password value after the
first time it uses it. Hence I need to find the
line containing "password" and replace the whole
line.

An alternate solution would be to find the string "password=" and then replace anything following in that line with whatever I specify. I just figure that the first approach is the simplest.

Thanks,
REMGU


See More: find text string in line & replace whole line

Report •

#1
July 8, 2010 at 09:42:26
Well in Visual BASIC you could do this

OPEN "REGISTRATION.TXT" FOR INPUT AS #1
INPUT #1, ID#
INPUT #1, User$
INPUT #1, Password$
INPUT #1, Location$
CLOSE #1

or:

http://www.vbforums.com/showthread....


Report •
Related Solutions


Ask Question