Find then use found to search second file for replacement

General discussions about Advanced Find and Replace
Post Reply
Posts: 1
Joined: Thu Sep 21, 2006 1:26 pm

Find then use found to search second file for replacement

Post by Colin » Thu Sep 21, 2006 2:09 pm

I am a new usr and have a particularly dfficult proble,

I have two files which have a common field between them. I wish to search the first file for a term then use that term to search the second file for the replacement line.

example text:

First file:


Second file:

Thus in the first line of the first file the text 58code_86D would be found.
The characters following "_" would be used to search the second file.
This would find the following "POWER_UP,CODE,086D,2941" .
This text would replace the text found in the first file.
Regexes would find both terms but I cannot work out whether the first found text can be passed to a variable that can be used to searc a second file.

Can this be done?

Colin Close

Site Admin
Posts: 1218
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre » Sun Sep 24, 2006 11:47 am

How many files do you have in total? Just two files file1 and file2 or
do you have hundreds of similar files?

In file1 do you need to search only once 58code_86D
or you have to iterate between all occurrences 58code_86D, then find
88C in file1 and replace 88C in file2 and so on.

I think that the best way to solve this task: you send to - file1,
file2 before replace, file2 after replace.
Kind regards,
Abacre Limited

Post Reply