Abacre Home > Advanced Find and Replace Home

Batch Replace options

Confirm before batch replace

Check it to show alert before an action with file.

Use Advanced Options of Find operation

By default AFR does not apply filters in advanced options (file date, size, length) for batch replace operation. Check this option ON if you want use these filters for batch replace operation.

Save as Unix files

You might know that Unix files use just 0x10 char as a separator for new line operation. But in MS DOS and Windows they use a pair 0x13 0x10. So when porting you files, for instance, Perl scripts, you may have difficulties with understanding your scripts by Unix platform.

When you check this options, AFR will save changed files with just 0x10 char as the new line separator and your scripts will be understandable for Unix!

For regular expressions modifiers, please see regular expressions syntax.

Note, when Use regular expressions is checked, case sensitive flag is defined by modifier I and not by case sensitive checkbox on front panel.

Please read description of Replace in MS Office files option in options of Replace operation.

Ignore from import lines

This parameter changes bahavior of Import values from file command of Batch replace operation. Check ON this parameter if you want to comment out some lines in batch import file. For example, you have the tab separated file for import into batch replace table:

A A1
#B B1
C C1

So when this parameter is ON, the line #B B1 will not be imported into batch table.

Replace in File Names and Replace in File Bodies

Both parameters controls behavior of Advanced Find and Replace. By default the options have the following states:
Replace in File Names is OFF
Replace in File Bodies is ON

So Advanced Find and Replace acts utility for replacements inside file bodies.

But if you want just to use AFR as file renamer (replace in file names) use the following states:
Replace in File Names is ON
Replace in File Bodies is OFF

Or you may activate both options. Note that Replace in File Names can work with lateral replacements and as well as with regular expressions (Use Regular Expressions is ON).

Include File Name into Search Scope

Often you may need to insert file name or part of file name into some part of file body. Use this option for the job. If the option is OFF AFR searches only file body. But when the option is ON AFR considers search scope as:

In terms of regular expressions it will be:

For example you have the sample file:

C:\Program Files\Advanced Find and Replace\samples\test1.htm

and you want to replace the text

This is a test file

by text:

This is a test1 file

Which means that instead of test we will put file name test1 into it.

What should you do to make the task:

Check ON: Include File Name into Search Scope option.

Go to Batch replace tab of the main window.

Check ON: "Use regular expressions".

Put into "Search for":
.*\\(\w+)\.htm\r\n(.+This is a )test

and into Replace with:

That's all. Note: you have to put \r\n at the beginning of replace with part because AFR should eliminate file name from the search scope at the final phase of replacement. The file name may be empty here as in this example.

When you use Include File Name into Search Scope option the first line of text (file name) may be changed. In this case checked Rename File Name if it was changed options allows to rename file name.

Replace until found

Use Replace until found option when you need to run batch replace several times on the source text until found any search for text.

For example if you have the sample source text:

Search for:

Replace with:

When Replace until found option is OFF AFR will simply remove first pair AAA AAA

and resulting text will be:

But when Replace until found option is ON AFR will remove all occurrences of AAA AAA and resulting text will be:

Normally you should use Replace until found option when you need to remove or change some lines of text within specified text block.

See also sample cases: case1, case2.

Max number of replacements is used in order to avoid indefinite loops of the program. This option only works when Replace until found option is OFF.

See also: Batch Replace operation | Find options | Replace options | Regular expressions | FAQ