I have already deleted all of our previous posts. I have completely rewritten the macro to get correct output(s) also when soft-wrapped lines exist. As a result of this the previous macro worked perfect until it reached the first line which was soft-wrapped.Īdditionally you have option Replace All is From Top of File active as you can see in the Replace dialog which makes the output even worse. Key HOME, Key END and SelectLine which I have used before for this macro to select a line with or without line ending are executed always on current displayed line which is not the entire real line if the line is currently soft-wrapped. I did not know how many macro commands depend on wrapping mode on/off. I use it normally only when editing HTML files, but have it not active when running macros or scripts. I normally have soft-wrapping of lines not active. The problem was the soft-wrapping you have enabled. With your configuration I was able to reproduce the problem and find the reason why the macro failed and created a wrong output (= damaged file). IfEof works for Unicode files only since UE v13.20. Also IfEof has been eliminated to let the macro work on Unicode files too, independent of the version of UltraEdit. The new macro works now also for a file with soft-wrapped lines. : The macro has been rewritten completely because it damaged the file when there are soft-wrapped lines. Use the command TrimTrailingSpaces at top of the macro after the command Top, if you want to ignore trailing spaces and you can delete it. If there are trailing spaces and the trailing spaces of 2 lines displayed identical do not match, the lines will not be removed and reported. The macro is designed to remove duplicate lines only if a line matches another line 100%. This macro will not work for Unix files opened in Unix mode without conversion temporarily (on file load) or permanently to DOS before macro execution (^p matches CR+LF). Macro command UnixReOff sets the regular expression option to UltraEdit style.Įdit info: Some comments added - see below! The macro property Continue if a Find with Replace not found or Continue if search string not found must be checked for this macro.Īdd UnixReOn or PerlReOn (v12+ of UE) at the end of the macro if you do not use UltraEdit style regular expressions by default - see search configuration. This macro is now added to my private collection of useful macros - see sticky forum topic Macro examples and reference for beginners and experts which contains a macro file with the macros DelDupInfo+ (macro below) and DelDupInfo- (macro below without the red lines). If someone wants this macro without collecting the duplicate line info, remove the red colored lines. The collection of the duplicate lines is done now with clipboard 8, which improves execution speed a lot. Remove MatchCase parameter if it should ignore case. The removing duplicate line replace command is now case-sensitive. Only 5 simple regular expressions must be changed for Unix style. It now could be also converted to a macro with Unix style regular expressions instead of UltraEdit style. Now it also works for files with lines with UltraEdit style regular expression characters and it does not need a second macro as I first thought would be necessary. Even an experienced user like I can learn from others. That was new for me although I have written dozens of UltraEdit macros. Thanks Bego for the idea to collect the duplicate lines as additional info and for the information that IfFound and IfNotFound can also be used after a replace. I have an idea how to do it without a regular expression search, but it is much more tricky and I now have no time to develop this macro set (it cannot be done with a single macro). The macro commands UnixReOn and UnixReOff modify this setting. Remove the last red command, if you use regular expression in UltraEdit style by default instead of Unix style.įor UltraEdit v11.10c and former versions see at Advanced - Configuration - Find setting Unix style Regular Expressions.įor UltraEdit v11.20 and later versions see at Advanced - Configuration - Searching setting Unix style Regular Expressions. Unix style cannot be used here, because ^c is not available in a Unix style search. See help of UltraEdit about regular expressions in UltraEdit style. The following macro should do the job, but only if no line exists which contains regular expression characters of UltraEdit style like +^%$.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |