Multi Commander > Support and Feedback

Find & Replace or MultiScript to edit & output XML?

<< < (3/3)

Ulfhednar:

--- Quote from: Jungle on December 08, 2022, 16:44:24 ---Well, S&R works:


--- Code: ---@var $sel_files = GetSourceSelectedPaths();
@var $sel_count = arrayCount($sel_files);
@var $find_text = "aaa\\nbbb";
@var $repl_text = "xxx\\nyyy";

@var $n;
for($n = 0; $n < $sel_count; $n++)
{
  @var $file = $sel_files[$n];
#  @var $new_file = PathGetPathPart($file) ^ PathGetNamePart($file, 1) + "_new" + PathGetFileExtPart($file);
  @var $new_file = "*_new.*";

  MC.Utils.FindAndReplace MODE="Many" FIND={$find_text} REPLACEWITH={$repl_text} FILE="{$file}" TARGET="{$new_file}" SILENT REPLACEALL OVERWRITE
}
--- End code ---

The full automation requires parsing CSV-file, of course. If its structure is known and "stable", it shouldn't be hard.

UPD. Actually, parsing CSV might be quite hard (in MC).

--- End quote ---

Leveraging  MC.Utils.FindAndReplace tool halts with error when trying non-overlapping search.  I presume this is the same error as most GREP tools I have tried  ie a non-match ends the forward stepping.
The only tool I found which does this out-of-the-box AFAIK is PowerGREP (https://www.powergrep.com/), this dev does some excellent work.
Unfortunately he's waaaaay out of my price-range esp. for a small personal project.

....But if I can find a tool I can understand like MultiScript, it is something I'd like to learn to do for myself, so all input is appreciated ;)

Navigation

[0] Message Index

[*] Previous page

Go to full version