Collating Sequence

One of the attributes you may specify is the name of a file containing a translation table. This enables you to create a custom collating sequence for the new file, instead of using the standard ASCII collating sequence. The exact format for the translation table is given here.

All white-space characters (space, tab, new line, etc.) are ignored, so the table can have as many lines and spaces as you desire.

The sequence of the characters in the table determines the collating sequence for keys. For example, a file which looks like this:

Z Y X W V U T S R Q P O N M L K J I H G F E D C B A

would sort keys reverse alphabetically, for the values in the range A to Z.

You may enter special characters by typing a backslash (\) and then the decimal value of the character desired. Thus, \032 would be used to specify the SPACE character.

Ranges can be specified with a dash (-). The sequence of the starting and ending characters in the range is significant. The reverse-alphabetical table shown above could be specified more concisely as:

Z - A

Finally, you can give two or more characters the same sort value by using an ampersand (&) between them. For example, the file will not distinguish case if you use a translation table with the following format:

a & A b & B c & C d & D e & E f & F g & G h & H i & I j & J
k & K l & L m & M n & N o & O p & P q & Q r & R s & S
t & T u & U v & V w & W x & X y & Y z & Z

Any characters in the native collating sequence that are not explicitly named in the table assume a position greater than any of the explicitly named characters. The relative order of these unnamed characters remains the same as in the native collating sequence. In the last example, all digits, punctuation, and control characters would be in their usual order, but after all alphabetic characters.