The

**Sort** feature sorts always entire lines in selected block or entire file. It does never sort words (space/tab separated strings) within a line. An UltraEdit script would be required for such a words sort within each line.

An example demonstrating numeric and column based sorts.

The file contains following lines:

Code: Select all

```
10 number 10
3 number 1000
2 number 1000
2 number 1000
1 number 100
```

The result is as follows for a standard ascending sort with all the checkbox options

**not** checked and start column of key 1 is

**1** and end column of key 1 is

**-1** and the start and end columns of the other three keys are all 0:

Code: Select all

```
1 number 100
10 number 10
2 number 1000
2 number 1
3 number 1000
```

That is a simple string based sort of the lines depending on the code values of the characters on each line. The first three characters of the lines as listed above have the following hexadecimal code values:

Code: Select all

```
31 20 20
31 30 20
32 20 20
32 20 6E
33 20 20
```

So a simple, non-numeric sort results in comparing two strings (lines) character by character to find out which string of the two compared strings is less or equal the other string depending on the code values of the characters.

The result is as follows for an ascending sort with checked option

**numeric sort** and all other checkbox options

**not** checked and start column of key 1 is

**1** and end column of key 1 is

**2**, start column of key 2 is

**3** and end column of key 2 is

**-1** and the start and end columns of the other two keys are all 0:

Code: Select all

```
1 number 100
2 number 1000
2 number 1
3 number 1000
10 number 10
```

The lines are sorted in this case first numeric according to the one or two digit number at beginning of each line and next according to the strings of the lines from column 3 to end of the line whereby on identical number at beginning the order of the lines does not change in this case.

For a numeric sort it is necessary to specify the columns containing the number on which the string should be converted to numbers. It is important for the numeric sort that the specified columns contain only digits and leading/trailing spaces/horizontal tabs, optionally a decimal-point and decimal places. One or more thousands separators are possible, too. The character left to first digit can be a

- sign (the ASCII hyphen-minus character and not the Unicode minus sign).

The result is as follows for an ascending sort with checked option

**numeric sort** and all other checkbox options

**not** checked and start column of key 1 is

**10** and end column of key 1 is

**14**, start column of key 2 is

**1** and end column of key 2 is

**2** and the start and end columns of the other two keys are all 0:

Code: Select all

```
2 number 1
10 number 10
1 number 100
2 number 1000
3 number 1000
```

The lines are sorted in this case first according to the second number in each line in the columns 10 to 14 (leading space is ignored on conversion of the number strings to numbers), and on identical number in these columns, second according to the first number in each line in the columns 1 and 2 (with the trailing space ignored on conversion of the number strings to numbers).

The column numbers can be seen on status bar at bottom of the main application window. It is advisable for a column/numeric sort to first determine all the column numbers by placing the caret to the columns and note down the column numbers shown in the status bar on a paper before opening the dialog window

**Advanced Sort/Options**.