Multi Commander > Support and Feedback

Find & Replace or MultiScript to edit & output XML?

(1/3) > >>

The question is, is the following task beyond the scope of F&R (&/or MS)? 
I have .xml's that need search & replace operations.
I need to check multiple files for each of the entries & replace if/where found.
All SAR terms are not in all files... Both searches & replacements will change over time.  ::)

The source for the search & the replacements is currently a CSV, >1000 rows/entries.
The job is thus:-

--- Code: ---Search for x where x is entry in CSV column 1;
   If CSV column 1 entry found, replace with CSV column 2 entry;  (Rows being SAR pairs 1|1, 2|2, 3|3 etc)
   If CSV column 1 entry not found;
Step down to next row, loop til end of CSV
Resulting XML to be saved with a new name
Next file
--- End code ---

So far in F&R I tried adding all column 1 entries to find & all column 2 entries to replace with "Find many, Replace with many" selected.
Result is error 87 see screen.
I'm guessing this is because there are mismatches & F&R doesn't step down to next term rather than there being too many entries.....?

...........Maybe I can leverage F&R with MS or something?

Any simple way to do this task?  Thanks in advance :)

Mathias (Author):
87 is a generic error that means invalid parameter

It hard to say what goes wrong, depends on that input and what options used and such.
Don't really understand what you are trying to do.. you say xml files but and then you say CSV file
But are text file.. the search and replace things work on text files. but do not handle xml/cvs files in any special way, but as pure text file.

if you want to do pairs of find and replace.. there must be correct number of them..
and option for find and replace is the second one "Find many, replace with many"

Thanks for the reply Mathias.

CSV is original source of search & replace terms; XML is target.  (I just copied CSV columns of data out to the F&R dialog, & gave it xml as target.)
I've listed the 'original operation' with CSV & XML labels as I wondered if MultiScript could handle those formats instead of using F&R for the job.

Basically I can exclude the CSV by transferring all the data to F&R input & output fields.
F&R seeing XML as TXT is not a problem as no formatting is altered. 
It seems to work if all search terms are found. 
So I guess the error must be because there is no 100% match between all CSV terms & all XML targets.

Problem is all XMLs are different i.e. not all terms are in all XMLs.  Because of this I need an EITHER OR function,
EITHER search / find/ replace
OR search / not find
THEN search next term in list
REPEAT til end of list.

I want to be able to step over non-matches or matches that have already been made....  I know this is possible but maybe not via MC.

So......  I'm guessing no non-overlapping SaR using script or MS rename tools is possible then...  :(

Hi Ulf.

Do you have a decent text editor that supports macros (Notepad++, UltraEdit, etc)?

As a programmer, I believe it would be quicker and less effort to use one of those as the tool for the job.


[0] Message Index

[#] Next page

Go to full version