Find in files: Finding files NOT matching the search term

Find, replace, find in files, replace in files, regular expressions

Find in files: Finding files NOT matching the search term

Postby HansFink » Fri Jan 27, 2006 12:48 pm

Hello,

I want to search several open files and list those files which don't match the search term.
User avatar
HansFink
Basic User
Basic User
 
Posts: 17
Joined: Fri Jan 27, 2006 12:00 am

Re: Finding files NOT matching the search term

Postby Mofi » Fri Jan 27, 2006 3:03 pm

Like your other question, this can be only done with a macro. The macro searches in every file for the term and closes all files which has the term. After macro execution only the files are opened which do not have the search term. You should save all files before the macro is executed. All files must be real files (not buffers) with a file name.

InsertMode
ColumnModeOff
HexOff
Loop
IfNameIs ""
ExitMacro
EndIf
Top
Find "your search"
IfFound
CloseFile
Else
"ThisIsTheFirstFileWithoutTheSearchString"
ExitLoop
EndIf
EndLoop
Loop
NextWindow
Top
Find MatchCase "ThisIsTheFirstFileWithoutTheSearchString"
IfFound
Delete
ExitMacro
Else
Find "your search"
IfFound
CloseFile
Else
NextWindow
EndIf
EndIf
EndLoop

And again don't forget to enable the macro property Continue if a Find with Replace not found.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4064
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Finding files NOT matching the search term

Postby Mofi » Thu May 31, 2007 2:53 pm

With UltraEdit v13.00 and UEStudio v6.20 (or any later/higher version) such a search is possible.

There is the Find In Files option Match Files if string is not found.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4064
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Find/Replace/Regular Expressions