Sorting FQDN.

Help with writing and playing macros

Sorting FQDN.

Postby gjandrews42 » Wed Sep 20, 2006 8:29 pm

I am trying to sort a list of FQDN [ Wikipedia FQDN ]

Example:

www.ultraedit.com.
idm.com.
www.idm.ultraedit.com.
www.idm.com.

would be sorted to

idm.com.
www.idm.com.
www.ultraedit.com.
www.idm.ultraedit.com.
User avatar
gjandrews42
Newbie
 
Posts: 1
Joined: Tue Sep 19, 2006 11:00 pm

Re: Sorting FQDN.

Postby Mofi » Thu Sep 21, 2006 10:53 am

The following macro sorts your example (copied into an ASCII file) as you want it. Hopefully it works for your whole list. The macro property Continue if a Find with Replace not found must be checked for this macro.

InsertMode
ColumnModeOff
HexOff
UnixReOff
Bottom
IfColNum 1
Else
"
"
EndIf
Top
Find RegExp "%^([~.^r^n]+.[~.^r^n]+.^)^([~.^r^n]+.^)^(?*^)$"
Replace All "^2^3»^1"
Find RegExp "%^([~.^r^n]+.^)^([~.^r^n]+.^)^([~»^r^n]+^)$"
Replace All "^2^3»^1"
SortAsc IgnoreCase 1 -1 0 0 0 0 0 0
Find RegExp "%^([~»^r^n]+^)»^(*^)$"
Replace All "^2^1"

Add 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. Macro command UnixReOff sets the regular expression option to UltraEdit style.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Macros