[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 System Management Guide: Operating System and Devices

Creating a New Collation Order

Procedure

  1. If you are using a locale source file named gwm , copy the provided locale source file that is closest to the desired character collation order to a file named gwm.src . This name cannot be the same as any previously defined locale. The system-defined locales are listed in "Understanding Locale".
    cd /usr/lib/nls/loc
    cp en_GB.ISO8859-1.src gwm.src
  2. Edit the newly created gwm.src file to change the lines that are associated within the LC_COLLATE category that is associated with the characters you want to change:
    vi gwm.src
       change
          <a>   <a>;<non-accent>;<lower-case>;IGNORE
          <b>   <b>;<non-accent>;<lower-case>;IGNORE
          <c>   <c>;<non-accent>;<lower-case>;IGNORE
          <d>   <d>;<non-accent>;<lower-case>;IGNORE
       to
          <a>   <d>;<non-accent>;<lower-case>;IGNORE
          <b>   <c>;<non-accent>;<lower-case>;IGNORE
          <c>   <b>;<non-accent>;<lower-case>;IGNORE
          <d>   <a>;<non-accent>;<lower-case>;IGNORE 
  3. Generate the new gwm locale:
    localedef -f ISO08859-1 -i gwm.src gwm
  4. Set the LOCPATH environment variable to the directory containing the new locale. If the new locale is in /u/foo , then enter:
    LOCPATH=/u/foo:/usr/lib/nls/loc; export LOCPATH
    The default for LOCPATH is /usr/lib/nls/loc.
    Note: All setuid and setgid programs ignore the LOCPATH environment variable.
  5. Change the LC_COLLATE environment variable to the name of the newly defined gwm locale binary:
    LC_COLLATE=gwm; export LC_COLLATE
    Any command will now use the collation order specified in the gwm locale. In this example, the characters a-d are sorted in reverse order by commands such as li, ls, and sort.

[ Previous | Next | Contents | Glossary | Home | Search ]