Modify Find in Files result with script

Modify Find in Files result with script

2

    Mar 10, 2011#1

    Hi!

    I am new to scripting.

    I have written a script that search through a folder containing x number of html files.

    And it works. Now my problem is that I want to edit the search result.

    Result looks like this: C:\Users\user\Documents\res\reports\boot_1.etl.verbose.html(176): <font color=#ff1111> 4,432 sec start: 21,065s end: 25,497s Core

    I would like to have it look like this: <font color=#ff1111> 4,432 sec start: 21,065s end: 25,497s Core

    How can I do this?

    Thankful for all help I can get!

    Nickelodian

    6,686585
    Grand MasterGrand Master
    6,686585

      Mar 11, 2011#2

      At Advanced - Configuration - Search - Set Find Output Format you could simply remove from Found Line the definition string $P($L): to get directly the format you want.

      If the find result is captured to a document window, you can use in your script a regular expression replace command (here with UltraEdit engine).

      UltraEdit.ueReOn();
      UltraEdit.activeDocument.top();
      UltraEdit.activeDocument.findReplace.mode=0;
      UltraEdit.activeDocument.findReplace.matchCase=false;
      UltraEdit.activeDocument.findReplace.matchWord=false;
      UltraEdit.activeDocument.findReplace.regExp=true;
      UltraEdit.activeDocument.findReplace.searchDown=true;
      UltraEdit.activeDocument.findReplace.searchInColumn=false;
      UltraEdit.activeDocument.findReplace.preserveCase=false;
      UltraEdit.activeDocument.findReplace.replaceAll=true;
      UltraEdit.activeDocument.findReplace.replaceInAllOpen=false;
      UltraEdit.activeDocument.findReplace.replace("%?:*: +", "");

      If the list of found strings is in the output window and you want to modify the content of the output window, true this script block:

      UltraEdit.selectClipboard(9);
      UltraEdit.outputWindow.copy();
      var sOutput = UltraEdit.clipboardContent.replace(/\b\w:\\.+?: +/g,"");
      UltraEdit.outputWindow.showStatus=false;
      UltraEdit.outputWindow.clear();
      UltraEdit.outputWindow.write(sOutput);
      // Or perhaps better the following line. I have not tested this script.
      // UltraEdit.outputWindow.write(sOutput.replace(/\r/g,""));
      if (UltraEdit.outputWindow.visible == false) UltraEdit.outputWindow.showWindow(true);
      UltraEdit.clearClipboard();
      UltraEdit.selectClipboard(0);

      2

        Mar 11, 2011#3

        Works great Thanks!!

        Nickelodian