It matters not for this purpose whether the file is Excel, tab or CSV format.
For convenience, I can assume that tab delimited will be used.
In any case, one can always paste & copy from an Excel worksheet to make a tab delimited text file.
The proposed extension is this:
Do not limit the replacement to a single column or field.
The search pattern will always remain as the first column.
Yet there are some distinct benefits to be gained by permitting a multi-column or multi-field replacement.
Example:
Suppose you have a set of files in which one line contains the following:
\id XXX
where XXX is different for each file.
Now suppose you wish to insert a different set of lines for each file, but each set will depend on the value of XXX.
The replacement file might look like this: (using \t here to denote a tab delimiter)
Code: Select all
GEN\tGEN\t\\h Genesis\t\\toc1 Genesis\t\\toc2 The first Book of Moses\t\\toc3 Gen.
EXO\tEXO\t\\h Exodus\t\\toc1 Exodus\t\\toc2 The second Book of Moses\t\\toc3 Exo.
...
etc
The double backslashes assume the replacement type is Perl.
One can then follow the above replace filter by a simple search replace
- with one entry:
\t,\n
(I am assuming CSV notation here)
i.e. Replace tabs by a new line (assume e.g. Unix style EOLs)
This changes the first multi-column replacement to a multi-line insertion, customised to suit each different file.
The first file would end up like this:The second would end up like this:Code: Select all
\id GEN \h Genesis \toc1 Genesis \toc2 The first Book of Moses \toc3 Gen.
and so on.Code: Select all
\id EXO \h Exodus \toc1 Exodus \toc2 The second Book of Moses \toc3 Exo.
This would be a powerful enhancement to the search/replace filter.
It would also be a significant simplification for users who have this kind of requirement.
Only one external file needs to be maintained, rather than a separate two column file for each replacement.
The help for this filter would need to explain the enhancement.
Best regards,
David