PDA

View Full Version : Text substitution question



Rickcr
03-04-2008, 04:41 PM
Hello all!

I am trying to edit three text files during an installation.

I've been trying to use the TextSub commands without success:

szFileName = TARGETDIR ^ "config\\server\\conmgr.properties";
szSearchStr = "<SSIDIR>";
TextSubSetValue ( "<SSIDIR>", TARGETDIR, FALSE );
nResult = FileGrep ( szFileName, szSearchStr, svReturnLine, nvLineNumber, RESTART );
while (nResult != END_OF_FILE)

TextSubSubstitute ( svReturnLine, FALSE );

nResult = FileGrep (szFileName, szSearchStr, svReturnLine, nvLineNumber, CONTINUE);
endwhile;


Can anyone point out how to make this work, or another way of stepping through a text file and replacing all instances of a tag?

I'll greatly appreciate any help with this! Thank you! :D

- Rick

Rickcr
03-05-2008, 07:59 PM
Well, in case some other poor slob comes upon this thread looking for the answer to this, I resolved it by doing the following instead:

while (nResult != END_OF_FILE)

StrReplace ( svReturnLine, szSearchStr, TARGETDIR, 0 );

FileInsertLine (szFileName, svReturnLine, nvLineNumber, REPLACE);

// Search again.

nResult = FileGrep (szFileName, szSearchStr, svReturnLine, nvLineNumber, CONTINUE);
endwhile;