Find in Files and output of found blocks instead of each first line only

Find in Files and output of found blocks instead of each first line only

4
NewbieNewbie
4

    May 27, 2014#1

    UltraEdit Professional Text/HEX Editor
    Version 21.10.0.1032
    Windows 7 Ultimate

    Hello all. I am attempting to use the Find in Files feature with a RegEx that returns results that span several lines.
    I would like to have those results written to a new edit window in their entirety; however, when matches occur they result written to the edit window is ONLY the first line up to the newline character.

    I think the resulting data and expression may best illustrate what I mean.

    Code: Select all

    Find '^<terminalCommand serialNumber="\d+4025" commandID="\d+">[\W]+?<timestamp>.*</timestamp>[\W]+?<terminalState id="\d+">CRADLED</terminalState>' in 'C:\temp\test.log\test.log.12' (5/23/2014 10:46:44 AM; 5/23/2014 3:32:38 PM):
    C:\temp\test.log\test.log.12(10410): <terminalCommand serialNumber="201154025" commandID="94">
    Found '^<terminalCommand serialNumber="\d+4025" commandID="\d+">[\W]+?<timestamp>.*</timestamp>[\W]+?<terminalState id="\d+">CRADLED</terminalState>' 1 time(s).
    Doing this same search with a normal find yields the entire match including the <crlf> in the Find String List window whenever a newline occurs. I can also select any or all of those results and then paste them to a new edit window and attain all of the match data (not just the first line). Hence the following:

    Code: Select all

    <terminalCommand serialNumber="201154025" commandID="94">
      
       
      <timestamp>2014-05-23 06:45:48 GMT-04:00</timestamp>
      
       
      <terminalState id="1">CRADLED</terminalState>
    
    From reading the help file, it seems the only string result data is contained in the $S variable, and this variable cannot be altered.
    Is there a way that I can have Find in Files produce the entire match without truncating the match at the newline character?

    Thank you in advance!

    6,686585
    Grand MasterGrand Master
    6,686585

      May 27, 2014#2

      I was quite sure that UltraEdit supported multi-line output for Find in Files and therefore tested this with several versions of UltraEdit after I could see that UE v21.10.0.1032 writes only first line of found block to output window/results file.

      Find in Files with multi-line output worked up to UE v18.20 with the minor problem that CRLF in input files was in output window/results file CRCRLF on all lines except the last one. But that could be fixed easily on results file by running a replace.

      The Perl regular expression engine was updated in UE v19.00 and several other changes were made on Find/Replace feature. And those changes cause a different behavior on output of Find in Files when searching for a block. Now just the first line is written into the output window/results file.

      I suggest to report this to IDM support by email as I don't think that this change in output behavior is on intention.

      In the meantime it is only possible to workaround this problem by using an UltraEdit script which
      • searches first for files containing the block,
      • extracts the file names of those files,
      • opens each of those files,
      • finds and copies all blocks from each file to a user clipboard,
      • and finally pastes all found blocks into a new file.
      Best regards from an UC/UE/UES for Windows user from Austria

      4
      NewbieNewbie
      4

        May 27, 2014#3

        Excellent. Your help is always appreciated, Mofi.