|Home » Products » UltraEdit/UEStudio » Menu Commands (UE) » File|
Article Number: 2231 | Last Updated: Fri, Nov 18, 2011 10:19 AM
This help topic applies to UltraEdit on Mac/Linux.
This command allows you to set the sort options and perform a sort of the active file or all open files. When the sort is executed, a pair of lines are compared as follows: sort compares each pair of fields, in the order specified, according to the associated ordering options, until a difference is found or no fields are left. If no key fields are specified, sort uses a default key of the entire line. Finally, as a last resort when all keys compare equal, sort compares entire lines as if no ordering options other than Reverse Order were specified.
The sort process has no limit on input line length or restrictions on bytes allowed within lines. In addition, if the final byte of an input file is not a newline, the sort silently supplies one. A line's trailing newline is not part of the line for comparison purposes.
When the Advanced Sort Options command is selected, a dialog is presented with the following options:
Using this dropdown users may configure the sort to affect either the Current Document or All Open Documents.
Output to New File
If this option is selected, the sort results will be written to a new file and the original source file will not be affected by the sort.
Merge Sort Results
This option is only active if All Open Documents is selected in the Sort dropdown. When selected, this causes all open documents to be sorted and merged into a single result file.
Using this dropdown, users may specify the sort method used to sort the active file(s). The following options affect the ordering of output lines. They may be specified globally or as part of a specific key field. If no key fields are specified, global options apply to comparison of entire lines; otherwise the global options are inherited by key fields that do not specify any special options of their own. The following options are available:
Details about the Version sort method
Version sorting handles the fact that file names frequently include indices or version numbers. Standard sorting usually does not produce the order that one expects because comparisons are made on a character-by-character basis. Version sorting is especially useful when browsing directories that contain many files with indices/version numbers in their names:
$ ls -1 $ ls -1v
Version-sorted strings are compared such that if ver1 and ver2 are version numbers and prefix and suffix (suffix matching the regular expression '(.[A-Za-z~][A-Za-z0-9~]*)*') are strings then ver1 < ver2 implies that the name composed of “prefix ver1 suffix” sorts before “prefix ver2 suffix”.
Note also that leading zeros of numeric parts are ignored:
$ ls -1 $ ls -1v
Some suffixes will not be matched by the regular expression mentioned above. Consequently these examples may not sort as you expect:
Use Entire Line as Key
If this option is selected, the entire line will be evaluated when sorting the file. Individual fields/characters are not used with this option.
If preferred, the user may specify keys which determine sorting methods and sorting order. Unless otherwise specified, sorting keys will inherit the global sort options for Ignore Case and Ignore Blanks.
Sorting Keys are defined by specifying the following items: Start Field, Start Char., End Field, End Char. Fields and character positions are numbered starting with 1; a character position of zero for End Char. indicates the field's last character. If field values are specified but the start and end character values are not, the sort key will default to the beginning and end of the specified field(s). Keys can span multiple fields.
The options Ignore Case, Ignore Blanks, and the sorting method selected are specific to the relevant key. If these options are not specified but the key fields and characters are specified, the specified keys will be sorted using the options specified globally.
Pressing the Sort button begins the sorting process using the specified parameters. Depending on the size of the file being sorted, you may notice a prompt indicating that the file is locked for sorting. While the file is being sorted, it is locked and may not be modified.
There are no attachments for this article.
UTF-8 to ASCII command
Viewed 3935 times since Thu, Oct 13, 2011
Unicode/ASCII/UTF-8 to UTF-8 command
Viewed 2464 times since Thu, Oct 13, 2011
Save As Dialog
Viewed 2218 times since Thu, Oct 20, 2011
UNIX/MAC to DOS command
Viewed 5433 times since Thu, Oct 13, 2011
UNICODE Big Endian to UNICODE command
Viewed 3239 times since Thu, Oct 13, 2011
Print All Files command
Viewed 2005 times since Thu, Oct 13, 2011
Save Selection As command
Viewed 2808 times since Thu, Oct 13, 2011
Viewed 2773 times since Thu, Oct 13, 2011
UTF-8 to Unicode command
Viewed 2599 times since Thu, Oct 13, 2011
Mirror Display Font command
Viewed 3255 times since Thu, Oct 13, 2011