cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Rickcr
Level 2

Text substitution question

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 = "";
TextSubSetValue ( "", 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! 😄

- Rick
Labels (1)
0 Kudos
(1) Reply
Rickcr
Level 2

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;
0 Kudos