help with a batch find and replace

General discussions about Advanced Find and Replace
Post Reply
fitzroy_doll
Posts: 2
Joined: Fri Oct 27, 2006 10:58 pm

help with a batch find and replace

Post by fitzroy_doll »

Hi

I have a folder containing 400 text files which I want to search for particular text. If this text is not found, I want to replace a different set of text with another word.

So I'll give you a three line example. Note that the following text each occurs within a much longer line of text which cannot be broken up.

Line 1. ALABASTRON, ITALY, ORVIETO, -525
Line 2. KRATER, -550
Line 3. AMPHORA A, RHODES, CAMIROS, -550

I want to search for (ITALY, ORVIETO, -) OR (RHODES, CAMIROS, -) Etc. etc.
and if these are not found then replace the , - with , NULL, -

I am seeking to use the , - (comma space hyphen) because this is the only regular occurance in the data. If the , - (comma space hypen) is NOT interrupted by any text which appears in my list, then I want to replace it with , NULL, - (comma space NULL comma hypen).

If it makes any difference there are about 40,000 lines in all, and about 1700 possible place names. I have entered these into Advanced Find And Replace without any difficulty, but I don't know how to tell the program to do the above.

How do I do this?

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

Post by Abacre »

The task is almost clear and it can be done with Advanced Find and
Replace. But please explain what do you mean by:

Note that the following text each occurs within a much longer line of text which cannot be broken up.


As far as I understood you have only 2 types of lines:

First type:
ANYTEXT, ANYTEXT, ANYTEXT, -ANYNUMBER

or you have just the second type:
ANYTEXT, -ANYNUMBER

So you want to standardize the text and transform all second type lines to
fist type lines by adding , NULL, -
the resulting text should be according to your examples:
ALABASTRON, ITALY, ORVIETO, -525
KRATER, NULL, NULL, -550
AMPHORA A, RHODES, CAMIROS, -550

Is it right?

The second question:
Do you have longer lines like:
ANYTEXT, ANYTEXT, ANYTEXT, ANYTEXT, -ANYNUMBER
or even like these lines:
ANYTEXT, ANYTEXT, ANYTEXT, ANYTEXT, ANYTEXT, -ANYNUMBER
ANYTEXT, ANYTEXT, ANYTEXT, ANYTEXT, ANYTEXT, ANYTEXT, -ANYNUMBER
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

fitzroy_doll
Posts: 2
Joined: Fri Oct 27, 2006 10:58 pm

Post by fitzroy_doll »

Thanks for your help. I have in the meantime found another solution.

Post Reply